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)
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)
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)
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)
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)
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)