Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_namefinder(self):
'test namefinder'
ast = self.interp.parse('x+y+cos(z)')
nf = NameFinder()
nf.generic_visit(ast)
self.assertTrue('x' in nf.names)
self.assertTrue('y' in nf.names)
self.assertTrue('z' in nf.names)
self.assertTrue('cos' in nf.names)
def test_namefinder(self):
'test namefinder'
ast = self.interp.parse('x+y+cos(z)')
nf = NameFinder()
nf.generic_visit(ast)
self.assertTrue('x' in nf.names)
self.assertTrue('y' in nf.names)
self.assertTrue('z' in nf.names)
self.assertTrue('cos' in nf.names)
def test_namefinder(self):
"""test namefinder"""
p = self.interp.parse('x+y+cos(z)')
nf = NameFinder()
nf.generic_visit(p)
self.assertTrue('x' in nf.names)
self.assertTrue('y' in nf.names)
self.assertTrue('z' in nf.names)
self.assertTrue('cos' in nf.names)
def test_namefinder(self):
"""test namefinder"""
p = self.interp.parse('x+y+cos(z)')
nf = NameFinder()
nf.generic_visit(p)
self.assertTrue('x' in nf.names)
self.assertTrue('y' in nf.names)
self.assertTrue('z' in nf.names)
self.assertTrue('cos' in nf.names)
def get_symbols(expression):
interpreter = asteval.Interpreter()
nf = asteval.NameFinder()
nf.generic_visit(interpreter.parse(expression))
return set(nf.names).difference(EXISTING_SYMBOLS)