MCPcopy Index your code
hub / github.com/python/cpython / test_Sized

Method test_Sized

Lib/test/test_collections.py:1324–1340  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1322 run_async(IgnoreGeneratorExit().aclose())
1323
1324 def test_Sized(self):
1325 non_samples = [None, 42, 3.14, 1j,
1326 _test_gen(),
1327 (x for x in []),
1328 ]
1329 for x in non_samples:
1330 self.assertNotIsInstance(x, Sized)
1331 self.assertNotIsSubclass(type(x), Sized)
1332 samples = [bytes(), str(),
1333 tuple(), list(), set(), frozenset(), dict(),
1334 dict().keys(), dict().items(), dict().values(),
1335 ]
1336 for x in samples:
1337 self.assertIsInstance(x, Sized)
1338 self.assertIsSubclass(type(x), Sized)
1339 self.validate_abstract_methods(Sized, '__len__')
1340 self.validate_isinstance(Sized, '__len__')
1341
1342 def test_Container(self):
1343 non_samples = [None, 42, 3.14, 1j,

Callers

nothing calls this directly

Calls 13

_test_genFunction · 0.85
strFunction · 0.85
listClass · 0.85
setFunction · 0.85
assertNotIsInstanceMethod · 0.80
assertNotIsSubclassMethod · 0.80
assertIsInstanceMethod · 0.80
assertIsSubclassMethod · 0.80
validate_isinstanceMethod · 0.80
keysMethod · 0.45
itemsMethod · 0.45

Tested by

no test coverage detected