Beispiel #1
0
 def test_comma_separated_values_with_decimal_separator(self):
     self.assertEqual(parse_array_of_floats("2.75,8.5"), [2.75, 8.5])
Beispiel #2
0
 def test_all_commas(self):
     self.assertEqual(parse_array_of_floats(",,,"), [0, 0, 0, 0])
Beispiel #3
0
 def test_value_with_decimal_separator(self):
     self.assertEqual(parse_array_of_floats("3.5"), [3.5])
Beispiel #4
0
 def test_omitted_value_with_comma(self):
     self.assertEqual(parse_array_of_floats("1,,3"), [1, 0, 3])
     self.assertEqual(parse_array_of_floats(",,3"), [0, 0, 3])
Beispiel #5
0
 def test_sign_as_separator(self):
     self.assertEqual(parse_array_of_floats("1-3"), [1, -3])
     self.assertEqual(parse_array_of_floats("1+3"), [1, 3])
Beispiel #6
0
 def test_mixed_separated_values(self):
     self.assertEqual(parse_array_of_floats("123,45 6,89"),
                      [123, 45, 6, 89])
     self.assertEqual(parse_array_of_floats("    123   45,6,89 "),
                      [123, 45, 6, 89])
Beispiel #7
0
 def test_single_value_exponent(self):
     self.assertEqual(parse_array_of_floats("12e+3"), [12000])
     self.assertEqual(parse_array_of_floats("12e-3"), [0.012])
Beispiel #8
0
 def test_single_value(self):
     self.assertEqual(parse_array_of_floats("123"), [123])
     self.assertEqual(parse_array_of_floats(" \t  123    \t"), [123])
Beispiel #9
0
 def test_empty(self):
     self.assertEqual(parse_array_of_floats(""), [])
     self.assertEqual(parse_array_of_floats("    "), [])
    def test_missing_decimal(self):
        self.assertEqual(parse_array_of_floats(".92"), [0.92])
        self.assertEqual(parse_array_of_floats(".92e+1"), [9.2])

        self.assertEqual(parse_array_of_floats("-.92"), [-0.92])
        self.assertEqual(parse_array_of_floats("-.92e+1"), [-9.2])