Ejemplo n.º 1
0
    def test_p13_point_mod_loc_from_tuple(self):
        """P-13. Verify mod of x, y using loc_from_tuple."""
        # Test point.loc_from_tuple(loc)
        # when point is an existing Point and loc is a tuple.
        # Make sure data is correct.
        location = 2, 3

        point = Point.from_tuple(location)
        self.assertEqual(point_data(point), location)
Ejemplo n.º 2
0
 def test_error_from_tuple(self):
     """P-12. Verify error when using from_tuple with no arguments."""
     with self.assertRaises(TypeError):
         Point.from_tuple()
Ejemplo n.º 3
0
 def test_from_tuple(self):
     """P-11. Create a Point using from_tuple."""
     expected = 2, 3
     location = 2, 3
     point = Point.from_tuple(location)
     self.assertEqual(point_data(point), expected)
Ejemplo n.º 4
0
 def test_create_point_from_tuple(self):
     """P-11. Create a Point using from_tuple."""
     expected = (3, 4)
     loc = (3, 4)
     point = Point.from_tuple(loc)
     self.assertEqual(point_data(point), expected)
Ejemplo n.º 5
0
 def test_p12_error_point_from_tuple_no_args(self):
     """P-12. Verify error when using from_tuple with no arguments"""
     # Test that Point.from_tuple() raises an error
     # NOT with try/except; use unittest.
     with self.assertRaises(TypeError):
         point = Point.from_tuple()