mirror of
https://github.com/python/cpython.git
synced 2025-12-04 00:30:19 +00:00
Nudge getting __module__ and __name__ for new-style classes so that
the results of *setting* __name__ are not so surprising. If people can suggest more tests, that'd be grand, or is what's there sufficient?
This commit is contained in:
parent
deaba57009
commit
ade8c8b2c3
2 changed files with 33 additions and 18 deletions
|
|
@ -3603,7 +3603,15 @@ def mutable_names():
|
|||
class C(object):
|
||||
pass
|
||||
|
||||
C.__name__ = 'C'
|
||||
# C.__module__ could be 'test_descr' or '__main__'
|
||||
mod = C.__module__
|
||||
|
||||
C.__name__ = 'D'
|
||||
vereq((C.__module__, C.__name__), (mod, 'D'))
|
||||
|
||||
C.__name__ = 'D.E'
|
||||
vereq((C.__module__, C.__name__), (mod, 'D.E'))
|
||||
|
||||
|
||||
def test_main():
|
||||
do_this_first()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue