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):
9090 break
9191 return
9292 elif isinstance (node , ast .If ):
93+ node_test = ast .unparse (node .test )
9394 # 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 :
9596 replace (node .lineno , 'if 1:' )
9697 # 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 :
9899 replace (node .lineno , 'if 0:' )
99100 # 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' :
101102 replace (node .lineno , 'if 0:' )
102103 elif isinstance (node , ast .Assign ) and isinstance (node .targets [0 ], ast .Name ) and node .targets [0 ].id == '__version__' :
103104 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):
1414 result_content = munge (test_path , "1.2.3" )
1515 result_path .write_text (result_content , encoding = "utf-8" )
1616
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" )
1919
20- assert result == expected
20+ assert result_content == expected_content
2121
2222 result_path .unlink ()
You can’t perform that action at this time.
0 commit comments