summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_abc.py
diff options
context:
space:
mode:
authorDaniel Andrade <dangro@users.noreply.github.com>2019-09-11 15:29:44 (GMT)
committerStéphane Wirtel <stephane@wirtel.be>2019-09-11 15:29:44 (GMT)
commit4a12a178f4a6b9a59d97fecc727f2b6b28dfc85f (patch)
treeb6ade2edb070705da46e18b2cbe299f3107f983d /Lib/test/test_abc.py
parent19f6940cd7fb91246b88e1fbdbce97a02e7f3fa1 (diff)
downloadcpython-4a12a178f4a6b9a59d97fecc727f2b6b28dfc85f.zip
cpython-4a12a178f4a6b9a59d97fecc727f2b6b28dfc85f.tar.gz
cpython-4a12a178f4a6b9a59d97fecc727f2b6b28dfc85f.tar.bz2
bpo-34331: Fix incorrectly pluralized abstract class error message. (GH-8670)
Diffstat (limited to 'Lib/test/test_abc.py')
-rw-r--r--Lib/test/test_abc.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py
index 9f5afb2..000e583 100644
--- a/Lib/test/test_abc.py
+++ b/Lib/test/test_abc.py
@@ -149,6 +149,25 @@ def test_factory(abc_ABCMeta, abc_get_cache_token):
self.assertEqual(D.foo(), 4)
self.assertEqual(D().foo(), 4)
+ def test_object_new_with_one_abstractmethod(self):
+ class C(metaclass=abc_ABCMeta):
+ @abc.abstractmethod
+ def method_one(self):
+ pass
+ msg = r"class C with abstract method method_one"
+ self.assertRaisesRegex(TypeError, msg, C)
+
+ def test_object_new_with_many_abstractmethods(self):
+ class C(metaclass=abc_ABCMeta):
+ @abc.abstractmethod
+ def method_one(self):
+ pass
+ @abc.abstractmethod
+ def method_two(self):
+ pass
+ msg = r"class C with abstract methods method_one, method_two"
+ self.assertRaisesRegex(TypeError, msg, C)
+
def test_abstractmethod_integration(self):
for abstractthing in [abc.abstractmethod, abc.abstractproperty,
abc.abstractclassmethod,