예제 #1
0
 def _assert_has_side_effects_and_not(
         self,
         code: str,
         expec_has_side_effects: scan.HasSideEffects,
         expec_not_side_effects=frozenset(),
 ):
     analyzer = scan.SideEffectsAnalyzer()
     analyzer.visit(ast.parse(code))
     assert analyzer.has_side_effects() is expec_has_side_effects
     self._assert_not_side_effects(analyzer._not_side_effects,
                                   expec_not_side_effects)
예제 #2
0
파일: test_scan.py 프로젝트: chvmq/pycln
 def test_check_names(self, names, expec_has_side_effects):
     aliases = [ast.alias(name=n, asname=None) for n in names]
     analyzer = scan.SideEffectsAnalyzer()
     assert analyzer._check_names(aliases) is expec_has_side_effects
예제 #3
0
파일: test_scan.py 프로젝트: chvmq/pycln
 def test_compute_not_side_effects(self, code, expec_not_side_effects):
     analyzer = scan.SideEffectsAnalyzer()
     analyzer._compute_not_side_effects(ast.parse(code).body[0])
     self._assert_not_side_effects(
         analyzer._not_side_effects, expec_not_side_effects
     )