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

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