diff options
Diffstat (limited to 'Lib/test/test_grammar.py')
-rw-r--r-- | Lib/test/test_grammar.py | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/Lib/test/test_grammar.py b/Lib/test/test_grammar.py index 4a480aa..cb37021 100644 --- a/Lib/test/test_grammar.py +++ b/Lib/test/test_grammar.py @@ -162,18 +162,18 @@ class GrammarTests(unittest.TestCase): def f3(two, arguments): pass def f4(two, (compound, (argument, list))): pass def f5((compound, first), two): pass - self.assertEquals(f2.func_code.co_varnames, ('one_argument',)) - self.assertEquals(f3.func_code.co_varnames, ('two', 'arguments')) + self.assertEquals(f2.__code__.co_varnames, ('one_argument',)) + self.assertEquals(f3.__code__.co_varnames, ('two', 'arguments')) if sys.platform.startswith('java'): - self.assertEquals(f4.func_code.co_varnames, + self.assertEquals(f4.__code__.co_varnames, ('two', '(compound, (argument, list))', 'compound', 'argument', 'list',)) - self.assertEquals(f5.func_code.co_varnames, + self.assertEquals(f5.__code__.co_varnames, ('(compound, first)', 'two', 'compound', 'first')) else: - self.assertEquals(f4.func_code.co_varnames, + self.assertEquals(f4.__code__.co_varnames, ('two', '.1', 'compound', 'argument', 'list')) - self.assertEquals(f5.func_code.co_varnames, + self.assertEquals(f5.__code__.co_varnames, ('.0', 'two', 'compound', 'first')) def a1(one_arg,): pass def a2(two, args,): pass @@ -209,9 +209,9 @@ class GrammarTests(unittest.TestCase): # ceval unpacks the formal arguments into the first argcount names; # thus, the names nested inside tuples must appear after these names. if sys.platform.startswith('java'): - self.assertEquals(v3.func_code.co_varnames, ('a', '(b, c)', 'rest', 'b', 'c')) + self.assertEquals(v3.__code__.co_varnames, ('a', '(b, c)', 'rest', 'b', 'c')) else: - self.assertEquals(v3.func_code.co_varnames, ('a', '.1', 'rest', 'b', 'c')) + self.assertEquals(v3.__code__.co_varnames, ('a', '.1', 'rest', 'b', 'c')) self.assertEquals(v3(1, (2, 3), 4), (1, 2, 3, (4,))) def d01(a=1): pass d01() @@ -302,23 +302,23 @@ class GrammarTests(unittest.TestCase): # argument annotation tests def f(x) -> list: pass - self.assertEquals(f.func_annotations, {'return': list}) + self.assertEquals(f.__annotations__, {'return': list}) def f(x:int): pass - self.assertEquals(f.func_annotations, {'x': int}) + self.assertEquals(f.__annotations__, {'x': int}) def f(*x:str): pass - self.assertEquals(f.func_annotations, {'x': str}) + self.assertEquals(f.__annotations__, {'x': str}) def f(**x:float): pass - self.assertEquals(f.func_annotations, {'x': float}) + self.assertEquals(f.__annotations__, {'x': float}) def f(x, y:1+2): pass - self.assertEquals(f.func_annotations, {'y': 3}) + self.assertEquals(f.__annotations__, {'y': 3}) def f(a, (b:1, c:2, d)): pass - self.assertEquals(f.func_annotations, {'b': 1, 'c': 2}) + self.assertEquals(f.__annotations__, {'b': 1, 'c': 2}) def f(a, (b:1, c:2, d), e:3=4, f=5, *g:6): pass - self.assertEquals(f.func_annotations, + self.assertEquals(f.__annotations__, {'b': 1, 'c': 2, 'e': 3, 'g': 6}) def f(a, (b:1, c:2, d), e:3=4, f=5, *g:6, h:7, i=8, j:9=10, **k:11) -> 12: pass - self.assertEquals(f.func_annotations, + self.assertEquals(f.__annotations__, {'b': 1, 'c': 2, 'e': 3, 'g': 6, 'h': 7, 'j': 9, 'k': 11, 'return': 12}) |