@@ -67,10 +67,10 @@ class TestSizedTypeValidation:
6767
6868 def test_positive_size_required (self ):
6969 """Test that size must be positive."""
70- with pytest .raises (AssertionError ):
70+ with pytest .raises (ValueError ):
7171 SizedType (NumericPrimitiveType .UINT , 0 )
7272
73- with pytest .raises (AssertionError ):
73+ with pytest .raises (ValueError ):
7474 SizedType (NumericPrimitiveType .UINT , - 1 )
7575
7676 def test_string_must_be_64_bits (self ):
@@ -147,3 +147,50 @@ def test_double_default_size(self):
147147 """Test default size for DOUBLE."""
148148 sized_type = SizedType .for_type (NumericPrimitiveType .DOUBLE )
149149 assert sized_type .size_bits == 64
150+
151+
152+ class TestSizedTypeNumericProperties :
153+ """Test SizedType numeric classification properties."""
154+
155+ def test_is_numeric_for_numeric_types (self ):
156+ """Test is_numeric returns True for numeric types."""
157+ assert SizedType (NumericPrimitiveType .INT , 32 ).is_numeric
158+ assert SizedType (NumericPrimitiveType .UINT , 32 ).is_numeric
159+ assert SizedType (NumericPrimitiveType .DOUBLE , 64 ).is_numeric
160+ assert SizedType (NumericPrimitiveType .RATIONAL , 128 ).is_numeric
161+
162+ def test_is_numeric_for_primitive_types (self ):
163+ """Test is_numeric returns False for primitive types."""
164+ assert not SizedType (PrimitiveType .BOOL , 1 ).is_numeric
165+ assert not SizedType (PrimitiveType .STRING , 64 ).is_numeric
166+
167+ def test_is_discrete_for_discrete_types (self ):
168+ """Test is_discrete returns True for discrete numeric types."""
169+ assert SizedType (NumericPrimitiveType .INT , 32 ).is_discrete
170+ assert SizedType (NumericPrimitiveType .UINT , 32 ).is_discrete
171+ assert SizedType (NumericPrimitiveType .INT , 64 ).is_discrete
172+
173+ def test_is_discrete_for_continuous_types (self ):
174+ """Test is_discrete returns False for continuous numeric types."""
175+ assert not SizedType (NumericPrimitiveType .DOUBLE , 64 ).is_discrete
176+ assert not SizedType (NumericPrimitiveType .RATIONAL , 128 ).is_discrete
177+
178+ def test_is_discrete_for_primitive_types (self ):
179+ """Test is_discrete returns False for primitive types."""
180+ assert not SizedType (PrimitiveType .BOOL , 1 ).is_discrete
181+ assert not SizedType (PrimitiveType .STRING , 64 ).is_discrete
182+
183+ def test_is_continuous_for_continuous_types (self ):
184+ """Test is_continuous returns True for continuous numeric types."""
185+ assert SizedType (NumericPrimitiveType .DOUBLE , 64 ).is_continuous
186+ assert SizedType (NumericPrimitiveType .RATIONAL , 128 ).is_continuous
187+
188+ def test_is_continuous_for_discrete_types (self ):
189+ """Test is_continuous returns False for discrete numeric types."""
190+ assert not SizedType (NumericPrimitiveType .INT , 32 ).is_continuous
191+ assert not SizedType (NumericPrimitiveType .UINT , 32 ).is_continuous
192+
193+ def test_is_continuous_for_primitive_types (self ):
194+ """Test is_continuous returns False for primitive types."""
195+ assert not SizedType (PrimitiveType .BOOL , 1 ).is_continuous
196+ assert not SizedType (PrimitiveType .STRING , 64 ).is_continuous
0 commit comments