@@ -848,42 +848,31 @@ def test_subset_years(self):
848848 self .assertEqual (tc_subset .data [3 ].time [0 ].item ().year , 2003 )
849849 self .assertEqual (tc_subset .data [3 ].time [0 ].item ().month , 4 )
850850
851- # improper calling
852-
853- # self.assertEqual(tc_subset.data[0].time[0].item().year, 2001)
854- # self.assertEqual(tc_subset.data[1].time[0].item().year, 2002)
855- # self.assertEqual(tc_subset.data[2].time[0].item().year, 2003)
856-
857- # # Invalid input: non-integer start_year
858- # with self.assertRaisesRegex(
859- # TypeError, "Both start_year and end_year must be integers."
860- # ):
861- # tc_test.subset_year(start_year="2000", end_year=2003)
862-
863- # # Invalid input: non-integer end_year
864- # with self.assertRaisesRegex(
865- # TypeError, "Both start_year and end_year must be integers."
866- # ):
867- # tc_test.subset_year(start_year=2000, end_year=None)
868-
869- # # Invalid range: start_year greater than end_year
870- # with self.assertRaisesRegex(
871- # ValueError, r"start_year \(2005\) cannot be greater than end_year \(2000\)."
872- # ):
873- # tc_test.subset_year(start_year=2005, end_year=2000)
874-
875- # # No tracks match the year range
876- # with self.assertRaisesRegex(
877- # ValueError, "No tracks found for the years between 2050 and 2060."
878- # ):
879- # tc_test.subset_year(start_year=2050, end_year=2060)
880-
881- # # Empty data case
882- # empty_tc = tc.TCTracks()
883- # with self.assertRaisesRegex(
884- # TypeError, "self.data should be a non-empty list of tracks."
885- # ):
886- # empty_tc.subset_year(start_year=2000, end_year=2010)
851+ # Invalid input: Mismatch between start_day and end_day
852+ with self .assertRaisesRegex (
853+ ValueError ,
854+ "Mismatch between start_year and end_year: "
855+ "Both must be either True or False." ,
856+ ):
857+ tc_test .subset_year ((2000 , False , False ), (False , False , False ))
858+ with self .assertRaisesRegex (
859+ ValueError ,
860+ "Mismatch between start_month and end_month: "
861+ "Both must be either True or False." ,
862+ ):
863+ tc_test .subset_year ((2000 , False , False ), (2000 , 5 , False ))
864+ with self .assertRaisesRegex (
865+ ValueError ,
866+ "Mismatch between start_day and end_day: "
867+ "Both must be either True or False." ,
868+ ):
869+ tc_test .subset_year ((False , False , False ), (False , False , 3 ))
870+ with self .assertRaisesRegex (ValueError , "Start year is after end year." ):
871+ tc_test .subset_year ((2007 , False , False ), (2000 , False , False ))
872+ with self .assertRaisesRegex (
873+ ValueError , "No tracks found for the specified date range"
874+ ):
875+ tc_test .subset_year ((2100 , False , False ), (2150 , False , False ))
887876
888877 def test_get_extent (self ):
889878 """Test extent/bounds attributes."""
0 commit comments