Fix parser identifiers and locale
This commit is contained in:
@@ -85,6 +85,31 @@ class TestMobileDeMapper(unittest.TestCase):
|
||||
self.assertEqual(record.origin_id, "mobile.de:456")
|
||||
self.assertEqual(record.origin, "MOBILE_DE")
|
||||
|
||||
def test_slug_includes_year_without_duplicate_or_trailing_hyphens(self) -> None:
|
||||
record = self.mapper.listing_to_car_record(
|
||||
MobileDeListing(
|
||||
id="457",
|
||||
url="https://suchen.mobile.de/fahrzeuge/details.html?id=457",
|
||||
title="Dodge -- Dart SXT!",
|
||||
first_registration="2013",
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(record.slug, "dodge-dart-sxt-2013")
|
||||
self.assertNotIn("--", record.slug)
|
||||
self.assertFalse(record.slug.endswith("-"))
|
||||
|
||||
def test_slug_omits_year_when_year_is_absent(self) -> None:
|
||||
record = self.mapper.listing_to_car_record(
|
||||
MobileDeListing(
|
||||
id="458",
|
||||
url="https://suchen.mobile.de/fahrzeuge/details.html?id=458",
|
||||
title="Dodge Dart SXT",
|
||||
)
|
||||
)
|
||||
|
||||
self.assertEqual(record.slug, "dodge-dart-sxt")
|
||||
|
||||
def test_unknown_empty_values_and_normalization(self) -> None:
|
||||
record = self.mapper.listing_to_car_record(
|
||||
MobileDeListing(
|
||||
@@ -138,7 +163,7 @@ class TestMobileDeMapper(unittest.TestCase):
|
||||
"attr": {
|
||||
"yc": "2016",
|
||||
"cn": "DE",
|
||||
"ecol": "Серебряный",
|
||||
"ecol": "Silber",
|
||||
"c": "OffRoad",
|
||||
"cc": "1 998 ccm",
|
||||
}
|
||||
@@ -160,7 +185,7 @@ class TestMobileDeMapper(unittest.TestCase):
|
||||
url="https://suchen.mobile.de/fahrzeuge/details.html?id=1002",
|
||||
title="BMW 320 Touring",
|
||||
subtitle="EstateCar",
|
||||
raw={"attr": {"ecol": "Коричневый"}},
|
||||
raw={"attr": {"ecol": "Braun"}},
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user