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

Method test_Callable

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

Source from the content-addressed store, hash-verified

1358 self.validate_isinstance(Container, '__contains__')
1359
1360 def test_Callable(self):
1361 non_samples = [None, 42, 3.14, 1j,
1362 "", b"", (), [], {}, set(),
1363 _test_gen(),
1364 (x for x in []),
1365 ]
1366 for x in non_samples:
1367 self.assertNotIsInstance(x, Callable)
1368 self.assertNotIsSubclass(type(x), Callable)
1369 samples = [lambda: None,
1370 type, int, object,
1371 len,
1372 list.append, [].append,
1373 ]
1374 for x in samples:
1375 self.assertIsInstance(x, Callable)
1376 self.assertIsSubclass(type(x), Callable)
1377 self.validate_abstract_methods(Callable, '__call__')
1378 self.validate_isinstance(Callable, '__call__')
1379
1380 def test_direct_subclassing(self):
1381 for B in Hashable, Iterable, Iterator, Reversible, Sized, Container, Callable:

Callers

nothing calls this directly

Calls 8

setFunction · 0.85
_test_genFunction · 0.85
assertNotIsInstanceMethod · 0.80
assertNotIsSubclassMethod · 0.80
assertIsInstanceMethod · 0.80
assertIsSubclassMethod · 0.80
validate_isinstanceMethod · 0.80

Tested by

no test coverage detected