Ejemplo n.º 1
0
    def test_logical(self):
        self.assertEqual(str(sym.logical_not(x == 0)), "!((x == 0))")

        # Test single-operand logical statements
        self.assertEqual(str(sym.logical_and(x >= 1)), "(x >= 1)")
        self.assertEqual(str(sym.logical_or(x >= 1)), "(x >= 1)")
        # Test binary operand logical statements
        self.assertEqual(str(sym.logical_and(x >= 1, x <= 2)),
                         "((x >= 1) and (x <= 2))")
        self.assertEqual(str(sym.logical_or(x <= 1, x >= 2)),
                         "((x >= 2) or (x <= 1))")
        # Test multiple operand logical statements
        self.assertEqual(str(sym.logical_and(x >= 1, x <= 2, y == 2)),
                         "((y == 2) and (x >= 1) and (x <= 2))")
        self.assertEqual(str(sym.logical_or(x >= 1, x <= 2, y == 2)),
                         "((y == 2) or (x >= 1) or (x <= 2))")
Ejemplo n.º 2
0
    def test_logical(self):
        numpy_compare.assert_equal(sym.logical_not(x == 0), "!((x == 0))")

        # Test single-operand logical statements
        numpy_compare.assert_equal(sym.logical_and(x >= 1), "(x >= 1)")
        numpy_compare.assert_equal(sym.logical_or(x >= 1), "(x >= 1)")
        # Test binary operand logical statements
        numpy_compare.assert_equal(sym.logical_and(x >= 1, x <= 2),
                                   "((x >= 1) and (x <= 2))")
        numpy_compare.assert_equal(sym.logical_or(x <= 1, x >= 2),
                                   "((x >= 2) or (x <= 1))")
        # Test multiple operand logical statements
        numpy_compare.assert_equal(sym.logical_and(x >= 1, x <= 2, y == 2),
                                   "((y == 2) and (x >= 1) and (x <= 2))")
        numpy_compare.assert_equal(sym.logical_or(x >= 1, x <= 2, y == 2),
                                   "((y == 2) or (x >= 1) or (x <= 2))")
Ejemplo n.º 3
0
    def test_logical(self):
        self.assertEqual(str(sym.logical_not(x == 0)),
                         "!((x == 0))")

        # Test single-operand logical statements
        self.assertEqual(str(sym.logical_and(x >= 1)), "(x >= 1)")
        self.assertEqual(str(sym.logical_or(x >= 1)), "(x >= 1)")
        # Test binary operand logical statements
        self.assertEqual(str(sym.logical_and(x >= 1, x <= 2)),
                         "((x >= 1) and (x <= 2))")
        self.assertEqual(str(sym.logical_or(x <= 1, x >= 2)),
                         "((x >= 2) or (x <= 1))")
        # Test multiple operand logical statements
        self.assertEqual(str(sym.logical_and(x >= 1, x <= 2, y == 2)),
                         "((y == 2) and (x >= 1) and (x <= 2))")
        self.assertEqual(str(sym.logical_or(x >= 1, x <= 2, y == 2)),
                         "((y == 2) or (x >= 1) or (x <= 2))")