@@ -31,7 +31,7 @@ def test_from_list():
3131def test_from_scalar_int ():
3232 """Test that scalar integers are properly converted to 1-dimensional arrays"""
3333 tensor = parse_obj_as (NdArray , 10 )
34-
34+
3535 assert isinstance (tensor , NdArray )
3636 assert isinstance (tensor , np .ndarray )
3737 # Scalar should be wrapped in 1-dimensional array
@@ -43,7 +43,7 @@ def test_from_scalar_int():
4343def test_from_scalar_float ():
4444 """Test that scalar floats are properly converted to 1-dimensional arrays"""
4545 tensor = parse_obj_as (NdArray , 10.5 )
46-
46+
4747 assert isinstance (tensor , NdArray )
4848 assert isinstance (tensor , np .ndarray )
4949 # Scalar should be wrapped in 1-dimensional array
@@ -54,20 +54,20 @@ def test_from_scalar_float():
5454
5555def test_from_scalar_complex ():
5656 """Test that scalar complex numbers are properly converted to 1-dimensional arrays"""
57- tensor = parse_obj_as (NdArray , 3 + 4j )
58-
57+ tensor = parse_obj_as (NdArray , 3 + 4j )
58+
5959 assert isinstance (tensor , NdArray )
6060 assert isinstance (tensor , np .ndarray )
6161 # Scalar should be wrapped in 1-dimensional array
6262 assert tensor .shape == (1 ,)
63- assert tensor [0 ] == 3 + 4j
63+ assert tensor [0 ] == 3 + 4j
6464 assert np .iscomplexobj (tensor )
6565
6666
6767def test_from_scalar_bool ():
6868 """Test that scalar booleans are properly converted to 1-dimensional arrays"""
6969 tensor = parse_obj_as (NdArray , True )
70-
70+
7171 assert isinstance (tensor , NdArray )
7272 assert isinstance (tensor , np .ndarray )
7373 # Scalar should be wrapped in 1-dimensional array
@@ -78,14 +78,15 @@ def test_from_scalar_bool():
7878
7979def test_from_scalar_in_document ():
8080 """Test that scalar values work correctly when used in a Document"""
81+
8182 class MyDoc (BaseDoc ):
8283 arr : NdArray
83-
84+
8485 # Test with integer
8586 doc_int = MyDoc (arr = 42 )
8687 assert doc_int .arr .shape == (1 ,)
8788 assert doc_int .arr [0 ] == 42
88-
89+
8990 # Test with float
9091 doc_float = MyDoc (arr = 3.14 )
9192 assert doc_float .arr .shape == (1 ,)
0 commit comments