Ejemplo n.º 1
0
 def test_p14_point_mod_loc_from_tuple_no_args(self):
     """P-14. Verify error when using loc_from_tuple with no arguments."""
     # Create a Point instance and test that using loc_from_tuple on
     # the point instance without any arguments raises an error.
     # NOT with try/except; use unittest.
     point = Point(3, 4)
     with self.assertRaises(TypeError):
         point.loc_from_tuple()
Ejemplo n.º 2
0
 def test_point_mod_loc_from_tuple(self):
     """P-13. Verify mod of x, y using loc_from_tuple."""
     expected = (3, 4)
     loc = (3, 4)
     point = Point()
     point_id = id(point)
     point.loc_from_tuple(loc)
     self.assertEqual(point_data(point), expected)
     self.assertEqual(id(point), point_id)
Ejemplo n.º 3
0
    def test_p11_create_point_from_tuple(self):
        """P-11. Create a Point using from_tuple."""
        # Test point = Point.from_tuple(loc)
        # where loc is a tuple
        # Make sure data is correct.
        point = Point(3, 4)
        expected = (5, 6)

        p_id = id(point)

        # If self is returned it will print point here. >>> point
        point.loc_from_tuple((5, 6))

        self.assertEqual(id(point), p_id)
        self.assertEqual(point_data(point), expected)
Ejemplo n.º 4
0
 def test_error_loc_from_tuple(self):
     """P-14.Verify error when using loc_from_tuple with no arguments."""
     point = Point(3, 4)
     with self.assertRaises(TypeError):
         point.loc_from_tuple()
Ejemplo n.º 5
0
 def test_modification_loc_from_tuple(self):
     """P-13. Verify modification of x,y using loc_from_tuple with values"""
     expected = 5, 6
     point = Point(3, 4)
     point.loc_from_tuple((5, 6))
     self.assertEqual(point_data(point), expected)
Ejemplo n.º 6
0
 def test_point_mod_loc_from_tuple_no_args(self):
     """P-14. Verify error when using loc_from_tuple with no arguments."""
     point = Point(2, 3)
     with self.assertRaises(TypeError):
         point.loc_from_tuple()
Ejemplo n.º 7
0
 def test_point_mod_loc_from_tuple(self):
     """P-13. Verify mod of x, y using loc_from_tuple."""
     expected = (5, 6)
     point = Point(3, 4)
     point.loc_from_tuple((5, 6))
     self.assertEqual(point_data(point), expected)