1
- from diffpy .utils .validators import is_number
2
1
import pytest
3
2
4
- @pytest .mark .parametrize ("input,expected" , [
5
- ("3.14" , True ), # Standard float
6
- ("2" , True ), # Integer
7
- ("-100" , True ), # Negative integer
8
- ("-3.14" , True ), # Negative float
9
- ("0" , True ), # Zero
10
- ("4.5e-1" , True ), # Scientific notation
11
- ("abc" , False ), # Non-numeric string
12
- ("" , False ), # Empty string
13
- ("3.14.15" , False ), # Multiple dots
14
- ("2+3" , False ), # Arithmetic expression
15
- ("NaN" , True ), # Not a Number (special float value)
16
- ("Infinity" , True ), # Positive infinity
17
- ("-Infinity" , True ), # Negative infinity
18
- ("Inf" , True ), # Positive infinity
19
- ("-Inf" , True ), # Negative infinity
20
- ])
3
+ from diffpy .utils .validators import is_number
4
+
5
+
6
+ @pytest .mark .parametrize (
7
+ "input,expected" ,
8
+ [
9
+ ("3.14" , True ), # Standard float
10
+ ("2" , True ), # Integer
11
+ ("-100" , True ), # Negative integer
12
+ ("-3.14" , True ), # Negative float
13
+ ("0" , True ), # Zero
14
+ ("4.5e-1" , True ), # Scientific notation
15
+ ("abc" , False ), # Non-numeric string
16
+ ("" , False ), # Empty string
17
+ ("3.14.15" , False ), # Multiple dots
18
+ ("2+3" , False ), # Arithmetic expression
19
+ ("NaN" , True ), # Not a Number (special float value)
20
+ ("Infinity" , True ), # Positive infinity
21
+ ("-Infinity" , True ), # Negative infinity
22
+ ("Inf" , True ), # Positive infinity
23
+ ("-Inf" , True ), # Negative infinity
24
+ ],
25
+ )
21
26
def test_is_number (input , expected ):
22
- assert is_number (input ) == expected
27
+ assert is_number (input ) == expected
0 commit comments