@@ -499,100 +499,3 @@ def test_table_time_columns_are_not_negative_multidimensional_pass():
499499 test_table .add_row (test_time = [0.0 , 1.0 , 2.0 , 3.0 ])
500500
501501 assert check_table_time_columns_are_not_negative (test_table ) is None
502-
503-
504- def test_check_units_table_duration_pass ():
505- """Test that units table with reasonable duration passes."""
506- units = Units (name = "units" )
507- units .add_unit (spike_times = [0.0 , 1.0 , 2.0 ])
508- units .add_unit (spike_times = [0.5 , 1.5 , 3.0 ])
509-
510- assert check_units_table_duration (units ) is None
511-
512-
513- def test_check_units_table_duration_pass_empty_spike_times ():
514- """Test that units table with no spike times passes."""
515- units = Units (name = "units" )
516- # Add a unit without spike_times
517- units .add_column (name = "custom_col" , description = "test" )
518- units .add_row (custom_col = 1 )
519-
520- assert check_units_table_duration (units ) is None
521-
522-
523- def test_check_units_table_duration_fail ():
524- """Test that units table with excessive duration fails."""
525- units = Units (name = "units" )
526- # Add spike times spanning more than 1 year (> 31557600 seconds)
527- units .add_unit (spike_times = [0.0 , 1.0 , 2.0 ])
528- units .add_unit (spike_times = [0.5 , 1.5 , 40000000.0 ]) # ~1.27 years
529-
530- result = check_units_table_duration (units )
531- assert result == InspectorMessage (
532- message = (
533- "Units table has a duration of 40000000.00 seconds "
534- "(1.27 years), which exceeds the threshold of "
535- "31557600.00 seconds (1.00 years). "
536- "This may indicate that spike_times are in the wrong units or there is a data quality issue."
537- ),
538- importance = Importance .CRITICAL ,
539- check_function_name = "check_units_table_duration" ,
540- object_type = "Units" ,
541- object_name = "units" ,
542- location = "/" ,
543- )
544-
545-
546- def test_check_units_table_duration_custom_threshold ():
547- """Test units table duration check with custom threshold."""
548- units = Units (name = "units" )
549- units .add_unit (spike_times = [0.0 , 100.0 ]) # 100 seconds
550-
551- # Should pass with default threshold
552- assert check_units_table_duration (units ) is None
553-
554- # Should fail with custom threshold of 50 seconds
555- result = check_units_table_duration (units , duration_threshold = 50.0 )
556- assert result == InspectorMessage (
557- message = (
558- "Units table has a duration of 100.00 seconds "
559- "(0.00 years), which exceeds the threshold of "
560- "50.00 seconds (0.00 years). "
561- "This may indicate that spike_times are in the wrong units or there is a data quality issue."
562- ),
563- importance = Importance .CRITICAL ,
564- check_function_name = "check_units_table_duration" ,
565- object_type = "Units" ,
566- object_name = "units" ,
567- location = "/" ,
568- )
569-
570-
571- def test_check_units_table_duration_single_unit ():
572- """Test that units table with a single unit and long duration is detected."""
573- units = Units (name = "units" )
574- units .add_unit (spike_times = [0.0 , 50000000.0 ]) # ~1.58 years
575-
576- result = check_units_table_duration (units )
577- assert result is not None
578- assert "Units table has a duration of 50000000.00 seconds" in result .message
579-
580-
581- def test_check_units_table_duration_first_unit_no_spikes ():
582- """Test that units table where first unit has no spikes works correctly."""
583- units = Units (name = "units" )
584- units .add_unit (spike_times = []) # First unit has no spikes
585- units .add_unit (spike_times = [0.0 , 1.0 , 2.0 ]) # Second unit has spikes
586-
587- # Should pass - duration is only 2 seconds
588- assert check_units_table_duration (units ) is None
589-
590-
591- def test_check_units_table_duration_second_unit_no_spikes ():
592- """Test that units table where second unit has no spikes works correctly."""
593- units = Units (name = "units" )
594- units .add_unit (spike_times = [0.0 , 1.0 , 2.0 ]) # First unit has spikes
595- units .add_unit (spike_times = []) # Second unit has no spikes
596-
597- # Should pass - duration is only 2 seconds
598- assert check_units_table_duration (units ) is None
0 commit comments