diff --git a/example.py b/example.py index d47a6d0..001e8b6 100644 --- a/example.py +++ b/example.py @@ -18,7 +18,7 @@ t=ValuesAxis[AwareDatetime](values=[datetime.now(tz=timezone.utc)]), ), ), - ranges={"temperature": NdArrayFloat(axisNames=["x", "y", "t"], shape=[1, 1, 1], values=[42.0])}, + ranges={"temperature": NdArrayFloat(axisNames=["x", "y", "t"], shape=[1, 1, 1], values=["42.0"])}, ) print(c.model_dump_json(exclude_none=True, indent=4)) diff --git a/tests/test_coverage.py b/tests/test_coverage.py index d4b02a1..e41b7d5 100644 --- a/tests/test_coverage.py +++ b/tests/test_coverage.py @@ -72,6 +72,8 @@ def test_happy_cases(file_name, object_type): ("mixed-type-axes.json", Axes, r"Input should be a valid number"), ("mixed-type-axes-2.json", Axes, r"Input should be a valid string"), ("mixed-type-ndarray-1.json", NdArrayFloat, r"Input should be a valid number"), + ("mixed-type-ndarray-1.json", NdArrayStr, r"Input should be 'string'"), + ("mixed-type-ndarray-2.json", NdArrayFloat, r"Input should be a valid number"), ("mixed-type-ndarray-2.json", NdArrayStr, r"Input should be 'string'"), ("mixed-type-ndarray-3.json", NdArrayInt, r"Input should be a valid integer"), ("mixed-type-ndarray-3.json", NdArrayFloat, r"Input should be 'float'"), diff --git a/tests/test_data/coverage-mixed-type-ndarray.json b/tests/test_data/coverage-mixed-type-ndarray.json index fc54522..e8c1132 100644 --- a/tests/test_data/coverage-mixed-type-ndarray.json +++ b/tests/test_data/coverage-mixed-type-ndarray.json @@ -111,7 +111,7 @@ ], "values": [ 1, - 2, + null, 3 ] }, diff --git a/tests/test_data/mixed-type-ndarray-1.json b/tests/test_data/mixed-type-ndarray-1.json index 2a173e1..3a48cf6 100644 --- a/tests/test_data/mixed-type-ndarray-1.json +++ b/tests/test_data/mixed-type-ndarray-1.json @@ -9,7 +9,7 @@ 2 ], "values": [ - "abc", + "42.0", 123 ] }