blob: 9223e5730f0ea0edeb58c6bcfd56ccd5e6dbe5dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# Test deprecation of co_lnotab
try:
(lambda: 0).__code__.co_code
except AttributeError:
print("SKIP")
raise SystemExit
import unittest
import sys
mpy_is_v2 = getattr(sys.implementation, '_v2', False)
def f():
pass
class Test(unittest.TestCase):
@unittest.skipIf(mpy_is_v2, "Removed in MicroPython v2 and later.")
def test_co_lnotab_exists(self):
self.assertIsInstance(f.__code__.co_lnotab, bytes)
@unittest.skipUnless(mpy_is_v2, "Not removed before MicroPython v2.")
def test_co_lnotab_removed(self):
with self.assertRaises(AttributeError):
f.__code__.co_lnotab
if __name__ == "__main__":
unittest.main()
|