def test_get_int_nullable(self):
     """Ensure that the nullable argument to get_int works as expected"""
     row = {"col1": None}
     self.assertEqual(get_int(row, "col1"), None)
     self.assertEqual(get_int(row, "col1", nullable=True), None)
     with self.assertRaises(ValueError):
         get_int(row, "col1", nullable=False)
 def test_get_int_with_value_error(self):
     """Test that get_int raises a ValueError when passed an invalid value"""
     row = {"col": "one"}
     with self.assertRaises(ValueError):
         get_int(row, "col")
 def test_get_int_from_string(self):
     """Test get_int with a string input"""
     row = {"col1": "1"}
     self.assertEqual(get_int(row, "col1"), 1)
 def test_get_int(self):
     """Test the basic functionality of the get_int function"""
     row = {"col1": 1, "col2": 2}
     self.assertEqual(get_int(row, "col1"), 1)
     self.assertEqual(get_int(row, "col2"), 2)
 def test_get_int_with_type_error(self):
     """Test that get_int raises a TypeError when transform produces the wrong type"""
     row = {"col": 1}
     with self.assertRaises(TypeError):
         get_int(row, "col", transform=str)