Esempio n. 1
0
 def test_lhs_point_gte(self):
     p1 = Point()
     p2 = Point(2, 4)
     self.assertTrue(p2 >= p1)
Esempio n. 2
0
 def test_rhs_point_gte(self):
     p1 = Point()
     p2 = Point(2, 4)
     self.assertFalse(p1 >= p2)
Esempio n. 3
0
 def test_point_inequality_same_points(self):
     p1 = Point(1, 2)
     p2 = Point(1, 2)
     self.assertFalse(p1 != p2)
Esempio n. 4
0
 def test_point_inequality_different_points(self):
     p1 = Point(1, 2)
     p2 = Point(2, 1)
     self.assertTrue(p1 != p2)
Esempio n. 5
0
 def test_string_conversion(self):
     self.assertEqual(str(Point(1, 2)), "(1, 2)")
Esempio n. 6
0
 def test_distance_from_south(self):
     self.assertAlmostEqual(Point(0, -3).distance(Point()), 3, places=6)
Esempio n. 7
0
 def test_distance_from_origin_north_west(self):
     self.assertAlmostEqual(Point(-4, 3).origin_distance(), 5, places=6)
Esempio n. 8
0
 def test_rhs_point_lte(self):
     p1 = Point()
     p2 = Point(2, 4)
     self.assertFalse(p2 <= p1)
Esempio n. 9
0
 def test_distance_from_origin_south(self):
     self.assertAlmostEqual(Point(0, -3).origin_distance(), 3, places=6)
Esempio n. 10
0
 def test_one_param_initializer(self):
     x, y = 2, 0
     p1 = Point(x)
     self.assertTrue(p1._x == x and p1._y == y)
Esempio n. 11
0
 def test_distance_from_origin_east(self):
     self.assertAlmostEqual(Point(3).origin_distance(), 3, places=6)
Esempio n. 12
0
 def test_distance_from_two_non_origin_points(self):
     self.assertAlmostEqual(Point(3, 4).distance(Point(6, 8)), 5, places=6)
Esempio n. 13
0
 def test_distance_from_north_east(self):
     self.assertAlmostEqual(Point(3, 4).distance(Point()), 5, places=6)
Esempio n. 14
0
 def test_lhs_point_lte(self):
     p1 = Point()
     p2 = Point(2, 4)
     self.assertTrue(p1 <= p2)
Esempio n. 15
0
 def test_two_param_initializer(self):
     x, y = 1, 2
     p1 = Point(x, y)
     self.assertTrue(p1._x == x, p1._y == y)
Esempio n. 16
0
 def test_default_initializer(self):
     x, y = 0, 0
     p1 = Point()
     self.assertTrue(p1._x == x and p1._y == y)
Esempio n. 17
0
    def test_equality_of_point_with_itself(self):

        point = Point()
        self.assertEqual(point, point)
Esempio n. 18
0
 def test_lte_with_equal(self):
     p1 = Point(2, 3)
     p2 = Point(2, 3)
     self.assertTrue(p1 <= p2)
Esempio n. 19
0
 def test_equality_of_points_same_coords(self):
     p1 = Point(1, 2)
     p2 = Point(1, 2)
     self.assertEqual(p1, p2)
Esempio n. 20
0
 def test_get_y(self):
     self.assertEqual(Point(1, 3).get_y(), 3)
Esempio n. 21
0
 def test_distance_from_west(self):
     self.assertAlmostEqual(Point(-3, 0).distance(Point()), 3, places=6)