diff options
author | Vlad Hoi <hoivladyslav@yahoo.com> | 2022-05-05 13:40:01 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 13:40:01 (GMT) |
commit | 42fee931d055a3ef8ed31abe44603b9b2856e04d (patch) | |
tree | 91ea3744ac0ad4c67322f356b0d5b8d48bc70334 /Lib/test/test_abc.py | |
parent | a95138b2c5a3ba3d9a1a635566e22e5843b6a45c (diff) | |
download | cpython-42fee931d055a3ef8ed31abe44603b9b2856e04d.zip cpython-42fee931d055a3ef8ed31abe44603b9b2856e04d.tar.gz cpython-42fee931d055a3ef8ed31abe44603b9b2856e04d.tar.bz2 |
bpo-43827: Make arguments to abc.ABCMeta.__new__ pos-only (#25385)
To avoid conflicts with `__init__subclass__`.
Diffstat (limited to 'Lib/test/test_abc.py')
-rw-r--r-- | Lib/test/test_abc.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py index c1d750d..1e7a035 100644 --- a/Lib/test/test_abc.py +++ b/Lib/test/test_abc.py @@ -668,6 +668,19 @@ def test_factory(abc_ABCMeta, abc_get_cache_token): class Receiver(ReceivesClassKwargs, abc_ABC, x=1, y=2, z=3): pass self.assertEqual(saved_kwargs, dict(x=1, y=2, z=3)) + + def test_positional_only_and_kwonlyargs_with_init_subclass(self): + saved_kwargs = {} + + class A: + def __init_subclass__(cls, **kwargs): + super().__init_subclass__() + saved_kwargs.update(kwargs) + + class B(A, metaclass=abc_ABCMeta, name="test"): + pass + self.assertEqual(saved_kwargs, dict(name="test")) + return TestLegacyAPI, TestABC, TestABCWithInitSubclass TestLegacyAPI_Py, TestABC_Py, TestABCWithInitSubclass_Py = test_factory(abc.ABCMeta, |