@@ -465,37 +465,55 @@ def test_empty_range(self):
465465 assert empty_range .isEmpty ()
466466
467467 def test_nrange_legacy_min_and_minvalue_conflict (self ):
468- """Ensure conflicting legacy 'min' and 'minValue' arguments raise a clear error."""
469468 with pytest .raises (ValueError , match = "Only one of 'minValue' and legacy 'min' may be specified" ):
470469 NRange (minValue = 0.0 , min = 1.0 )
471470
472471 def test_nrange_legacy_min_must_be_numeric (self ):
473- """Ensure legacy 'min' argument must be numeric."""
474472 with pytest .raises (ValueError , match = r"Legacy 'min' argument must be an integer or float\." ):
475473 NRange (min = "not-a-number" )
476474
475+ def test_nrange_legacy_max_and_maxvalue_conflict (self ):
476+ with pytest .raises (ValueError , match = "Only one of 'maxValue' and legacy 'max' may be specified" ):
477+ NRange (maxValue = 10.0 , max = 11.0 )
478+
479+ def test_nrange_legacy_max_must_be_numeric (self ):
480+ with pytest .raises (ValueError , match = r"Legacy 'max' argument must be an integer or float\." ):
481+ NRange (max = "not-a-number" )
482+
477483 def test_nrange_unexpected_kwargs_error_message (self ):
478- """Ensure unexpected keyword arguments produce a helpful error."""
479484 with pytest .raises (ValueError , match = r"Unexpected keyword arguments for NRange: .*" ):
480485 NRange (foo = 1 )
481486
482487 def test_nrange_maxvalue_and_until_conflict (self ):
483- """Ensure conflicting 'maxValue' and 'until' arguments raise a clear error."""
484488 with pytest .raises (ValueError , match = "Only one of 'maxValue' or 'until' may be specified." ):
485489 NRange (maxValue = 10 , until = 20 )
486490
487491 def test_nrange_discrete_range_requires_min_max_step (self ):
488- """Ensure getDiscreteRange validates required attributes."""
489492 rng = NRange (minValue = 0.0 , maxValue = 10.0 )
490493 with pytest .raises (ValueError , match = "Range must have 'minValue', 'maxValue', and 'step' defined\\ ." ):
491494 _ = rng .getDiscreteRange ()
492495
493496 def test_nrange_discrete_range_step_must_be_non_zero (self ):
494- """Ensure getDiscreteRange validates non-zero step."""
495497 rng = NRange (minValue = 0.0 , maxValue = 10.0 , step = 0 )
496498 with pytest .raises (ValueError , match = "Parameter 'step' must be non-zero when computing discrete range\\ ." ):
497499 _ = rng .getDiscreteRange ()
498500
501+ def test_nrange_adjust_for_byte_type_maxvalue_out_of_range (self ):
502+ rng = NRange (maxValue = 300 ) # above allowed ByteType max of 256
503+ with pytest .raises (
504+ ValueError ,
505+ match = r"`maxValue` must be within the valid range \(0 - 256\) for ByteType\." ,
506+ ):
507+ rng .adjustForColumnDatatype (ByteType ())
508+
509+ def test_nrange_get_continuous_range_requires_min_and_max (self ):
510+ rng = NRange (minValue = None , maxValue = 10.0 )
511+ with pytest .raises (
512+ ValueError ,
513+ match = r"Range must have 'minValue' and 'maxValue' defined\." ,
514+ ):
515+ _ = rng .getContinuousRange ()
516+
499517 def test_reversed_ranges (self ):
500518 testDataSpec = (
501519 dg .DataGenerator (sparkSession = spark , name = "ranged_data" , rows = 100000 , partitions = 4 )
@@ -561,8 +579,6 @@ def test_date_time_ranges(self):
561579 rowCount = rangedDF .count ()
562580 assert rowCount == 100000
563581
564- # TODO: add additional validation statement
565-
566582 @pytest .mark .parametrize ("asHtml" , [True , False ])
567583 def test_script_table (self , asHtml ):
568584 testDataSpec = (
0 commit comments