Esempio n. 1
0
 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'])
Esempio n. 2
0
 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'])
Esempio n. 3
0
 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'])