def test_uses_data_function_returns_nested_variable_names(self): logic = { 'if': [{ '>': [{ 'var': 'a' }, { 'var': ['b'] }] }, { 'var': ['c', 3] }, { '+': [{ 'var': 'd' }, 10] }] } variables = uses_data(logic) self.assertSequenceEqual(variables, ['a', 'b', 'c', 'd'])
def test_uses_data_function_returns_unique_variable_names(self): logic = { 'if': [{ '>': [{ 'var': 'a' }, { 'var': 'b' }] }, { 'var': 'a' }, { '*': [{ 'var': 'b' }, 2] }] } variables = uses_data(logic) self.assertSequenceEqual(variables, ['a', 'b'])
def test_uses_data_function_returns_variable_names(self): logic = {'+': [{'var': 'a'}, {'var': ['b', 2]}, 3, {'var': ['c']}]} variables = uses_data(logic) self.assertSequenceEqual(variables, ['a', 'b', 'c'])