示例#1
0
    def test_broadcast_equals(self):
        v1 = Variable((), np.nan)
        v2 = Variable(('x'), [np.nan, np.nan])
        self.assertTrue(v1.broadcast_equals(v2))
        self.assertFalse(v1.equals(v2))
        self.assertFalse(v1.identical(v2))

        v3 = Variable(('x'), [np.nan])
        self.assertTrue(v1.broadcast_equals(v3))
        self.assertFalse(v1.equals(v3))
        self.assertFalse(v1.identical(v3))

        self.assertFalse(v1.broadcast_equals(None))

        v4 = Variable(('x'), [np.nan] * 3)
        self.assertFalse(v2.broadcast_equals(v4))
示例#2
0
    def test_broadcast_equals(self):
        v1 = Variable((), np.nan)
        v2 = Variable(('x'), [np.nan, np.nan])
        self.assertTrue(v1.broadcast_equals(v2))
        self.assertFalse(v1.equals(v2))
        self.assertFalse(v1.identical(v2))

        v3 = Variable(('x'), [np.nan])
        self.assertTrue(v1.broadcast_equals(v3))
        self.assertFalse(v1.equals(v3))
        self.assertFalse(v1.identical(v3))

        self.assertFalse(v1.broadcast_equals(None))

        v4 = Variable(('x'), [np.nan] * 3)
        self.assertFalse(v2.broadcast_equals(v4))
示例#3
0
    def test_no_conflicts(self):
        v1 = Variable(('x'), [1, 2, np.nan, np.nan])
        v2 = Variable(('x'), [np.nan, 2, 3, np.nan])
        self.assertTrue(v1.no_conflicts(v2))
        self.assertFalse(v1.equals(v2))
        self.assertFalse(v1.broadcast_equals(v2))
        self.assertFalse(v1.identical(v2))

        self.assertFalse(v1.no_conflicts(None))

        v3 = Variable(('y'), [np.nan, 2, 3, np.nan])
        self.assertFalse(v3.no_conflicts(v1))

        d = np.array([1, 2, np.nan, np.nan])
        self.assertFalse(v1.no_conflicts(d))
        self.assertFalse(v2.no_conflicts(d))

        v4 = Variable(('w', 'x'), [d])
        self.assertTrue(v1.no_conflicts(v4))