def test_helpers_str2num(self): test_data = "123" normal_data = 123 result = helpers.str2num(test_data, "int") self.assertEqual(result, normal_data) test_data = "1,000" normal_data = 1000 result = helpers.str2num(test_data, "int") self.assertEqual(result, normal_data) test_data = "123.05" normal_data = 123.05 result = helpers.str2num(test_data, "float") self.assertAlmostEqual(result, normal_data) test_data = "1,023.05" normal_data = 1023.05 result = helpers.str2num(test_data, "float") self.assertAlmostEqual(result, normal_data)
def test_helpers_str2num(self): test_data = '123' normal_data = 123 result = helpers.str2num(test_data, 'int') self.assertEqual(result, normal_data) test_data = '1,000' normal_data = 1000 result = helpers.str2num(test_data, 'int') self.assertEqual(result, normal_data) test_data = '123.05' normal_data = 123.05 result = helpers.str2num(test_data, 'float') self.assertAlmostEqual(result, normal_data) test_data = '1,023.05' normal_data = 1023.05 result = helpers.str2num(test_data, 'float') self.assertAlmostEqual(result, normal_data)