Пример #1
0
 def test_nest_by_oper_with_arrays(self):
     """Test and expression with arrays (combined expressions)."""
     nested_expr = ConditionalSimplifier.nest_by_oper(
         [['a', '&', 'b'], '&', ['b', '&', 'c']], '&')
     self.assertIsInstance(nested_expr, list)
     self.assertEqual([['a', '&', 'b'], '&', ['b', '&', 'c']],
                      nested_expr)
Пример #2
0
 def test_nest_by_oper_not_matching_operator(self):
     """Test when the operation is simply not found. Same input returned."""
     input_expr = ['a', 'xor', 'b', 'not', 'c']
     nested_expr = ConditionalSimplifier.nest_by_oper(input_expr, 'mod')
     self.assertIsInstance(nested_expr, list)
     self.assertEqual(input_expr, nested_expr)
Пример #3
0
 def test_nest_by_oper_simple(self):
     """Test the case where we have a simple expression."""
     nested_expr = ConditionalSimplifier.nest_by_oper(
         ['a', '||', 'b', '||', 'c'], '||')
     self.assertIsInstance(nested_expr, list)
     self.assertEqual([['a', '||', 'b'], '||', 'c'], nested_expr)
Пример #4
0
 def test_nest_by_oper_not_matching_operator(self):
     """Test when the operation is simply not found. Same input returned."""
     input_expr = ['a', 'xor', 'b', 'not', 'c']
     nested_expr = ConditionalSimplifier.nest_by_oper(input_expr, 'mod')
     self.assertIsInstance(nested_expr, list)
     self.assertEqual(input_expr, nested_expr)
Пример #5
0
 def test_nest_by_oper_simple(self):
     """Test the case where we have a simple expression."""
     nested_expr = ConditionalSimplifier.nest_by_oper(['a', '||', 'b',
                                                       '||', 'c'], '||')
     self.assertIsInstance(nested_expr, list)
     self.assertEqual([['a', '||', 'b'], '||', 'c'], nested_expr)