Date an undated season photo by its season

A photo filed under "<year> Formula One season cars" is of that season, and the service refuses
a pick without a date: a season candidate whose file gives none takes the season's year, marked
"date_from": "category". An undated layout candidate still stays out.

Claude-Session: https://claude.ai/code/session_01NcbgfJAa38xFpzy69BWrqh
This commit is contained in:
2026-11-27 15:30:31 +01:00
parent 445235ca58
commit 58ac9472d0
2 changed files with 23 additions and 2 deletions
+11
View File
@@ -77,6 +77,17 @@ class CandidateTest(unittest.TestCase):
self.assertIn("not a photo", why)
class SeasonDateTest(unittest.TestCase):
def test_an_undated_season_photo_takes_its_seasons_year_and_says_so(self):
c = cc.dated_by_season({"file": "Kubica spa.jpg", "date": None}, 2008)
self.assertEqual((c["date"], c["date_from"]), ("2008", "category"))
def test_a_dated_season_photo_keeps_its_own_date(self):
c = cc.dated_by_season({"file": "A.jpg", "date": "2009-05-01"}, 2008)
self.assertEqual(c["date"], "2009-05-01")
self.assertNotIn("date_from", c)
class AerialTest(unittest.TestCase):
def test_a_search_hit_is_aerial_only_when_commons_says_so(self):
def hit(file, cats, found):