mirror of
https://github.com/python/cpython.git
synced 2025-07-12 13:55:34 +00:00
gh-132775: Add _PyFunction_GetXIData() (gh-133481)
This commit is contained in:
parent
121ed71f4e
commit
8cf4947b0f
5 changed files with 103 additions and 0 deletions
|
@ -758,6 +758,40 @@ class CodeTests(_GetXIDataTests):
|
|||
])
|
||||
|
||||
|
||||
class ShareableFuncTests(_GetXIDataTests):
|
||||
|
||||
MODE = 'func'
|
||||
|
||||
def test_stateless(self):
|
||||
self.assert_roundtrip_not_equal([
|
||||
*defs.STATELESS_FUNCTIONS,
|
||||
# Generators can be stateless too.
|
||||
*defs.FUNCTION_LIKE,
|
||||
])
|
||||
|
||||
def test_not_stateless(self):
|
||||
self.assert_not_shareable([
|
||||
*(f for f in defs.FUNCTIONS
|
||||
if f not in defs.STATELESS_FUNCTIONS),
|
||||
])
|
||||
|
||||
def test_other_objects(self):
|
||||
self.assert_not_shareable([
|
||||
None,
|
||||
True,
|
||||
False,
|
||||
Ellipsis,
|
||||
NotImplemented,
|
||||
9999,
|
||||
'spam',
|
||||
b'spam',
|
||||
(),
|
||||
[],
|
||||
{},
|
||||
object(),
|
||||
])
|
||||
|
||||
|
||||
class PureShareableScriptTests(_GetXIDataTests):
|
||||
|
||||
MODE = 'script-pure'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue