Example #1
0
 def test_squares_floats(self):
     """When passed a float, it should square it"""
     self.assertEqual(square(1.5), 2.25)
Example #2
0
 def test_string_fail(self):
     """Trying to square a string raises a TypeError"""
     with self.assertRaises(TypeError):
         square('string')
Example #3
0
 def test_squares_ints(self):
     """When passed an integer, it should square it"""
     self.assertEqual(square(2), 4)