@@ -68,6 +68,11 @@ def test_convert_to_numeric(self):
68
68
bone ._convert_to_numeric ("xyz" )
69
69
with self .assertRaises (ValueError ):
70
70
bone ._convert_to_numeric ("1.2.3" )
71
+ # rounding
72
+ self .assertEqual (42.12 , bone ._convert_to_numeric (42.1234 ))
73
+ self .assertEqual (42.0 , bone ._convert_to_numeric (42.00001 ))
74
+ self .assertEqual (42.07 , bone ._convert_to_numeric (42.066 ))
75
+ self .assertEqual (42.06 , bone ._convert_to_numeric (42.064 ))
71
76
72
77
bone = NumericBone (precision = 0 )
73
78
self .assertEqual (42 , bone ._convert_to_numeric (42 ))
@@ -76,7 +81,7 @@ def test_convert_to_numeric(self):
76
81
self .assertEqual (42 , bone ._convert_to_numeric (42.0 ))
77
82
self .assertEqual (42 , bone ._convert_to_numeric ("42.6" ))
78
83
self .assertEqual (42 , bone ._convert_to_numeric ("42,6" ))
79
- self .assertEqual (42 , bone ._convert_to_numeric (" 42,6" ))
84
+ self .assertEqual (42 , bone ._convert_to_numeric ({ "val" : " 42,6", "idx" : "42,6" } ))
80
85
self .assertEqual (42 , bone ._convert_to_numeric ({"val" : "42" , "idx" : "42" }))
81
86
with self .assertRaises (ValueError ):
82
87
bone ._convert_to_numeric ("123.456,5" )
0 commit comments