File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
circuitpython_build_tools Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -90,14 +90,15 @@ def process_statement(node):
90
90
break
91
91
return
92
92
elif isinstance (node , ast .If ):
93
+ node_test = ast .unparse (node .test )
93
94
# return the statements in the 'if' branch of 'if sys.implementation...: ...'
94
- if ast . unparse ( node . test ) == sys_implementation_is_circuitpython :
95
+ if node_test == sys_implementation_is_circuitpython :
95
96
replace (node .lineno , 'if 1:' )
96
97
# return the statements in the 'else' branch of 'if sys.implementation...: ...'
97
- if ast . unparse ( node . test ) == sys_implementation_not_circuitpython or ast . unparse ( node . test ) == sys_implementation_not_circuitpython2 :
98
+ elif node_test == sys_implementation_not_circuitpython or node_test == sys_implementation_not_circuitpython2 :
98
99
replace (node .lineno , 'if 0:' )
99
100
# return the statements in the else branch of 'if TYPE_CHECKING: ...'
100
- elif ast . unparse ( node . test ) == 'TYPE_CHECKING' :
101
+ elif node_test == 'TYPE_CHECKING' :
101
102
replace (node .lineno , 'if 0:' )
102
103
elif isinstance (node , ast .Assign ) and isinstance (node .targets [0 ], ast .Name ) and node .targets [0 ].id == '__version__' :
103
104
replace (node .lineno , f"__version__ = \" { version_str } \" " )
Original file line number Diff line number Diff line change @@ -14,9 +14,9 @@ def test_munge(test_path):
14
14
result_content = munge (test_path , "1.2.3" )
15
15
result_path .write_text (result_content , encoding = "utf-8" )
16
16
17
- expected = test_path .with_suffix (".exp" )
18
- expected_content = expected .read_text (encoding = "utf-8" )
17
+ expected_path = test_path .with_suffix (".exp" )
18
+ expected_content = expected_path .read_text (encoding = "utf-8" )
19
19
20
- assert result == expected
20
+ assert result_content == expected_content
21
21
22
22
result_path .unlink ()
You can’t perform that action at this time.
0 commit comments