summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_support.py
diff options
context:
space:
mode:
authorGregory P. Smith <greg@krypto.org>2015-04-14 20:26:06 (GMT)
committerGregory P. Smith <greg@krypto.org>2015-04-14 20:26:06 (GMT)
commit4e72cceb628010b5f30dce7a2883cda92ed61393 (patch)
tree5a35eb4a268eed10f58089fdda43d16d841563c6 /Lib/test/test_support.py
parent1bef9075b86512ec618b96f6f3a22353154f26b7 (diff)
downloadcpython-4e72cceb628010b5f30dce7a2883cda92ed61393.zip
cpython-4e72cceb628010b5f30dce7a2883cda92ed61393.tar.gz
cpython-4e72cceb628010b5f30dce7a2883cda92ed61393.tar.bz2
issue9859: Document test.support.detect_api_mismatch() and simplify its test.
Diffstat (limited to 'Lib/test/test_support.py')
-rw-r--r--Lib/test/test_support.py50
1 files changed, 20 insertions, 30 deletions
diff --git a/Lib/test/test_support.py b/Lib/test/test_support.py
index 4a27c44..2c00417 100644
--- a/Lib/test/test_support.py
+++ b/Lib/test/test_support.py
@@ -280,46 +280,36 @@ class TestSupport(unittest.TestCase):
self.assertEqual(D["item"], 5)
self.assertEqual(D["item"], 1)
+ class RefClass:
+ attribute1 = None
+ attribute2 = None
+ _hidden_attribute1 = None
+ __magic_1__ = None
+
+ class OtherClass:
+ attribute2 = None
+ attribute3 = None
+ __magic_1__ = None
+ __magic_2__ = None
+
def test_detect_api_mismatch(self):
- class RefClass:
- attribute1 = None
- attribute2 = None
- _hidden_attribute1 = None
- __magic_1__ = None
-
- class OtherClass:
- attribute2 = None
- attribute3 = None
- __magic_1__ = None
- __magic_2__ = None
-
- missing_items = support.detect_api_mismatch(RefClass, OtherClass)
+ missing_items = support.detect_api_mismatch(self.RefClass,
+ self.OtherClass)
self.assertEqual({'attribute1'}, missing_items)
- missing_items = support.detect_api_mismatch(OtherClass, RefClass)
+ missing_items = support.detect_api_mismatch(self.OtherClass,
+ self.RefClass)
self.assertEqual({'attribute3', '__magic_2__'}, missing_items)
def test_detect_api_mismatch__ignore(self):
- class RefClass:
- attribute1 = None
- attribute2 = None
- _hidden_attribute1 = None
- __magic_1__ = None
-
- class OtherClass:
- attribute2 = None
- attribute3 = None
- __magic_1__ = None
- __magic_2__ = None
-
ignore = ['attribute1', 'attribute3', '__magic_2__', 'not_in_either']
- missing_items = support.detect_api_mismatch(RefClass, OtherClass,
- ignore=ignore)
+ missing_items = support.detect_api_mismatch(
+ self.RefClass, self.OtherClass, ignore=ignore)
self.assertEqual(set(), missing_items)
- missing_items = support.detect_api_mismatch(OtherClass, RefClass,
- ignore=ignore)
+ missing_items = support.detect_api_mismatch(
+ self.OtherClass, self.RefClass, ignore=ignore)
self.assertEqual(set(), missing_items)
# XXX -follows a list of untested API