Improve coverage of artist_to_metadata(), checking for ended/endarea/enddate

- drop redundant test
This commit is contained in:
Laurent Monin
2023-06-02 15:38:29 +02:00
parent a962f9176e
commit ee76bf9e51
2 changed files with 97 additions and 16 deletions

View File

@@ -0,0 +1,79 @@
{
"name": "Serge Gainsbourg",
"sort-name": "Gainsbourg, Serge",
"isnis": [
"0000000115935851"
],
"life-span": {
"ended": true,
"begin": "1928-04-02",
"end": "1991-03-02"
},
"id": "b21ef19b-c6aa-4775-90d3-3cc3e067ce6d",
"end_area": {
"sort-name": "Paris",
"name": "Paris",
"iso-3166-2-codes": [
"FR-75"
],
"type-id": null,
"disambiguation": "",
"id": "dc10c22b-e510-4006-8b7f-fecb4f36436e",
"type": null
},
"begin-area": {
"disambiguation": "",
"type": null,
"id": "dc10c22b-e510-4006-8b7f-fecb4f36436e",
"name": "Paris",
"iso-3166-2-codes": [
"FR-75"
],
"type-id": null,
"sort-name": "Paris"
},
"type-id": "b6e035f4-3ce9-331c-97df-83397230b0df",
"area": {
"iso-3166-1-codes": [
"FR"
],
"disambiguation": "",
"id": "08310658-51eb-3801-80de-5a0739207115",
"type": null,
"sort-name": "France",
"name": "France",
"type-id": null
},
"country": "FR",
"ipis": [
"00011123948",
"00011935702",
"00012741616"
],
"gender": "Male",
"gender-id": "36d3d30a-839d-3eda-8cb3-29be4384e4a9",
"type": "Person",
"disambiguation": "",
"end-area": {
"sort-name": "Paris",
"name": "Paris",
"iso-3166-2-codes": [
"FR-75"
],
"type-id": null,
"disambiguation": "",
"id": "dc10c22b-e510-4006-8b7f-fecb4f36436e",
"type": null
},
"begin_area": {
"disambiguation": "",
"type": null,
"id": "dc10c22b-e510-4006-8b7f-fecb4f36436e",
"name": "Paris",
"iso-3166-2-codes": [
"FR-75"
],
"type-id": null,
"sort-name": "Paris"
}
}

View File

@@ -468,22 +468,6 @@ class NullMediaTest(MBJSONTest):
self.assertEqual(m, {})
class ArtistTest(MBJSONTest):
filename = 'artist.json'
def test_artist(self):
m = Metadata()
artist_to_metadata(self.json_doc, m)
self.assertEqual(m['area'], 'United Kingdom')
self.assertEqual(m['beginarea'], 'Hebden Bridge')
self.assertEqual(m['begindate'], '1991-02-17')
self.assertEqual(m['gender'], 'Male')
self.assertEqual(m['musicbrainz_artistid'], 'b8a7c51f-362c-4dcb-a259-bc6e0095f0a6')
self.assertEqual(m['name'], 'Ed Sheeran')
self.assertEqual(m['type'], 'Person')
class NullArtistTest(MBJSONTest):
filename = 'artist_null.json'
@@ -494,6 +478,24 @@ class NullArtistTest(MBJSONTest):
self.assertEqual(m, {})
class ArtistEndedTest(MBJSONTest):
filename = 'artist_ended.json'
def test_artist_ended(self):
m = Metadata()
artist_to_metadata(self.json_doc, m)
self.assertEqual(m['area'], 'France')
self.assertEqual(m['beginarea'], 'Paris')
self.assertEqual(m['begindate'], '1928-04-02')
self.assertEqual(m['endarea'], 'Paris')
self.assertEqual(m['enddate'], '1991-03-02')
self.assertEqual(m['gender'], 'Male')
self.assertEqual(m['musicbrainz_artistid'], 'b21ef19b-c6aa-4775-90d3-3cc3e067ce6d')
self.assertEqual(m['name'], 'Serge Gainsbourg')
self.assertEqual(m['type'], 'Person')
class ArtistTranslationTest(MBJSONTest):
filename = 'artist.json'