def test_try_str_to_float_infinity(self):
     """
     Tests try_str_to_float for infinity-like values.  We want it to return None
     """
     for testval in self.INFINITY_STRINGS:
         self.assertTrue(math.isinf(float(testval)))
         self.assertIsNone(try_str_to_float(testval))
 def test_try_str_to_float_no_exception(self):
     """
     Tests try_str_to_float for cases where float() doesn't throw an exception
     """
     for testval, float_output, expected in self.EXPECTED_RESULTS:
         self.assertEqual(float_output, float(testval))
         self.assertEqual(expected, try_str_to_float(testval))
 def test_try_str_to_float_nan(self):
     """
     Tests try_str_to_float for NaN-like values.  We want it to return None
     """
     for testval in self.NAN_STRINGS:
         self.assertTrue(math.isnan(float(testval)))
         self.assertIsNone(try_str_to_float(testval))
 def test_try_str_to_float_infinity(self):
     """
     Tests try_str_to_float for infinity-like values.  We want it to return None
     """
     for testval in self.INFINITY_STRINGS:
         self.assertTrue(math.isinf(float(testval)))
         self.assertIsNone(try_str_to_float(testval))
 def test_try_str_to_float_nan(self):
     """
     Tests try_str_to_float for NaN-like values.  We want it to return None
     """
     for testval in self.NAN_STRINGS:
         self.assertTrue(math.isnan(float(testval)))
         self.assertIsNone(try_str_to_float(testval))
 def test_try_str_to_float_no_exception(self):
     """
     Tests try_str_to_float for cases where float() doesn't throw an exception
     """
     for testval, float_output, expected in self.EXPECTED_RESULTS:
         self.assertEqual(float_output, float(testval))
         self.assertEqual(expected, try_str_to_float(testval))
 def test_try_str_to_float_with_exception(self):
     """
     Tests try_str_to_float for cases where float() throws an exception
     """
     for testval, float_exception, expected in self.EXPECTED_CONVERSION_EXCEPTIONS:
         with self.assertRaises(float_exception):
             float(testval)
         self.assertEqual(expected, try_str_to_float(testval))
 def test_try_str_to_float_with_exception(self):
     """
     Tests try_str_to_float for cases where float() throws an exception
     """
     for testval, float_exception, expected in self.EXPECTED_CONVERSION_EXCEPTIONS:
         with self.assertRaises(float_exception):
             float(testval)
         self.assertEqual(expected, try_str_to_float(testval))