MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_Callable

Method test_Callable

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

Source from the content-addressed store, hash-verified

1357 self.validate_isinstance(Container, '__contains__')
1358
1359 def test_Callable(self):
1360 non_samples = [None, 42, 3.14, 1j,
1361 "", b"", (), [], {}, set(),
1362 _test_gen(),
1363 (x for x in []),
1364 ]
1365 for x in non_samples:
1366 self.assertNotIsInstance(x, Callable)
1367 self.assertNotIsSubclass(type(x), Callable)
1368 samples = [lambda: None,
1369 type, int, object,
1370 len,
1371 list.append, [].append,
1372 ]
1373 for x in samples:
1374 self.assertIsInstance(x, Callable)
1375 self.assertIsSubclass(type(x), Callable)
1376 self.validate_abstract_methods(Callable, '__call__')
1377 self.validate_isinstance(Callable, '__call__')
1378
1379 def test_direct_subclassing(self):
1380 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
assertIsInstanceMethod · 0.80
validate_isinstanceMethod · 0.80
assertNotIsSubclassMethod · 0.45
assertIsSubclassMethod · 0.45

Tested by

no test coverage detected