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

Method test___code__

Lib/test/test_funcattrs.py:242–270  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

240
241 @unittest.expectedFailure # TODO: RUSTPYTHON
242 def test___code__(self):
243 num_one, num_two = 7, 8
244 def a(): pass
245 def b(): return 12
246 def c(): return num_one
247 def d(): return num_two
248 def e(): return num_one, num_two
249 for func in [a, b, c, d, e]:
250 self.assertEqual(type(func.__code__), types.CodeType)
251 self.assertEqual(c(), 7)
252 self.assertEqual(d(), 8)
253 d.__code__ = c.__code__
254 self.assertEqual(c.__code__, d.__code__)
255 self.assertEqual(c(), 7)
256 # self.assertEqual(d(), 7)
257 try:
258 b.__code__ = c.__code__
259 except ValueError:
260 pass
261 else:
262 self.fail("__code__ with different numbers of free vars should "
263 "not be possible")
264 try:
265 e.__code__ = d.__code__
266 except ValueError:
267 pass
268 else:
269 self.fail("__code__ with different numbers of free vars should "
270 "not be possible")
271
272 @unittest.expectedFailure # TODO: RUSTPYTHON
273 def test_blank_func_defaults(self):

Callers

nothing calls this directly

Calls 4

dFunction · 0.85
cClass · 0.70
assertEqualMethod · 0.45
failMethod · 0.45

Tested by

no test coverage detected