Esempio n. 1
0
    def test_deep_eq_generators(self):
        gen_a = (x for x in range(10))
        gen_b = (x for x in range(10))
        self.assertTrue(_utils.deep_eq(gen_a, gen_b))

        gen_c = (x for x in range(9))
        self.assertFalse(_utils.deep_eq(gen_a, gen_c))
Esempio n. 2
0
    def test_deep_eq_generators(self):
        gen_a = (x for x in range(10))
        gen_b = (x for x in range(10))
        self.assertTrue(_utils.deep_eq(gen_a, gen_b))

        gen_c = (x for x in range(9))
        self.assertFalse(_utils.deep_eq(gen_a, gen_c))
Esempio n. 3
0
    def test_deep_eq_primitives(self):
        # It should work with primitives also.
        self.assertTrue(_utils.deep_eq(5, 5.0))
        self.assertTrue(_utils.deep_eq(5, 5))
        self.assertTrue(_utils.deep_eq('foo', 'foo'))

        self.assertFalse(_utils.deep_eq('foo', 'bar'))
        self.assertFalse(_utils.deep_eq(5, '5'))
Esempio n. 4
0
    def test_deep_eq_primitives(self):
        # It should work with primitives also.
        self.assertTrue(_utils.deep_eq(5, 5.0))
        self.assertTrue(_utils.deep_eq(5, 5))
        self.assertTrue(_utils.deep_eq('foo', 'foo'))

        self.assertFalse(_utils.deep_eq('foo', 'bar'))
        self.assertFalse(_utils.deep_eq(5, '5'))
Esempio n. 5
0
    def test_deep_eq_neq(self):
        # Test with different polygon geometries nested inside of source model
        # objects.
        self.a2.geometry = models.AreaGeometry(wkt=self.POLY2)

        self.assertFalse(_utils.deep_eq(self.s1, self.s2))
Esempio n. 6
0
    def test_deep_eq_mixed_up_types(self):
        # Here, we specify the wrong type of geometry (area geom for a point)
        self.p2.geometry = models.AreaGeometry(wkt=self.POINT)

        self.assertFalse(_utils.deep_eq(self.s1, self.s2))
Esempio n. 7
0
 def test_deep_eq(self):
     # Typical case.
     self.assertTrue(_utils.deep_eq(self.s1, self.s2))
Esempio n. 8
0
    def test_deep_eq_dict_with_generator(self):
        a = dict(a=1, b=2, c=(x for x in range(10)))
        b = dict(a=1, b=2, c=xrange(10))

        self.assertTrue(_utils.deep_eq(a, b))
Esempio n. 9
0
    def test_deep_eq_list_with_generator(self):
        a = [1, 2, 3, (x for x in range(10))]
        b = [1, 2, 3, xrange(10)]

        self.assertTrue(_utils.deep_eq(a, b))
Esempio n. 10
0
 def test_deep_eq_mixed_iterables(self):
     gen = (x for x in range(10))
     xr = xrange(10)
     self.assertTrue(_utils.deep_eq(gen, xr))
Esempio n. 11
0
    def test_deep_eq_neq(self):
        # Test with different polygon geometries nested inside of source model
        # objects.
        self.a2.geometry = models.AreaGeometry(wkt=self.POLY2)

        self.assertFalse(_utils.deep_eq(self.s1, self.s2))
Esempio n. 12
0
    def test_deep_eq_mixed_up_types(self):
        # Here, we specify the wrong type of geometry (area geom for a point)
        self.p2.geometry = models.AreaGeometry(wkt=self.POINT)

        self.assertFalse(_utils.deep_eq(self.s1, self.s2))
Esempio n. 13
0
 def test_deep_eq(self):
     # Typical case.
     self.assertTrue(_utils.deep_eq(self.s1, self.s2))
Esempio n. 14
0
    def test_deep_eq_dict_with_generator(self):
        a = dict(a=1, b=2, c=(x for x in range(10)))
        b = dict(a=1, b=2, c=xrange(10))

        self.assertTrue(_utils.deep_eq(a, b))
Esempio n. 15
0
    def test_deep_eq_list_with_generator(self):
        a = [1, 2, 3, (x for x in range(10))]
        b = [1, 2, 3, xrange(10)]

        self.assertTrue(_utils.deep_eq(a, b))
Esempio n. 16
0
 def test_deep_eq_mixed_iterables(self):
     gen = (x for x in range(10))
     xr = xrange(10)
     self.assertTrue(_utils.deep_eq(gen, xr))