def test_01(self): iterator = Bootstrapper.get_iterator('label') label_element = next(iterator) label_element = next(iterator) label_element = next(iterator) actual = stringtools.normalize(Bootstrapper.prettify(label_element)) expected = stringtools.normalize(u''' <?xml version="1.0" ?> <label> <id>3</id> <name>Seasons Recordings</name> <contactinfo>Seasons Recordings 2236 Pacific Avenue Suite D Costa Mesa, CA 92627 Jamie Thinnes Tel: 949-574-5255 Fax: 949-574-0255 [email protected] [email protected] </contactinfo> <profile>California Deep-House Label Founded By Jamie Thinnes. The First 10 Records Were Released on [l=Earthtones Recordings] </profile> <data_quality>Correct</data_quality> <sublabels> <label>Seasons Classics</label> <label>Seasons Limited</label> </sublabels> </label> ''') assert actual.splitlines() == expected.splitlines() label_document = library.Label.from_element(label_element) actual = format(label_document) expected = stringtools.normalize(u''' discograph.library.mongo.Label( discogs_id=3, name='Seasons Recordings', sublabels=[ discograph.library.mongo.LabelReference( name='Seasons Classics', ), discograph.library.mongo.LabelReference( name='Seasons Limited', ), ], ) ''') assert actual == expected
def test_01(self): iterator = Bootstrapper.get_iterator('artist') artist_element = next(iterator) artist_element = next(iterator) actual = Bootstrapper.prettify(artist_element) expected = stringtools.normalize(''' <?xml version="1.0" ?> <artist> <id>2</id> <name>Mr. James Barth & A.D.</name> <realname>Cari Lekebusch & Alexi Delano</realname> <profile/> <data_quality>Correct</data_quality> <namevariations> <name>Mr Barth & A.D.</name> <name>MR JAMES BARTH & A. D.</name> <name>Mr. Barth & A.D.</name> <name>Mr. James Barth & A. D.</name> </namevariations> <aliases> <name>ADCL</name> <name>Alexi Delano & Cari Lekebusch</name> <name>Crushed Insect & The Sick Puppy</name> <name>Puente Latino</name> <name>Yakari & Delano</name> </aliases> <members> <id>26</id> <name>Alexi Delano</name> <id>27</id> <name>Cari Lekebusch</name> </members> </artist> ''') assert actual.splitlines() == expected.splitlines() artist_document = library.Artist.from_element(artist_element) actual = format(artist_document) expected = stringtools.normalize(''' discograph.library.mongo.Artist( aliases=[ discograph.library.mongo.ArtistReference( name='ADCL', ), discograph.library.mongo.ArtistReference( name='Alexi Delano & Cari Lekebusch', ), discograph.library.mongo.ArtistReference( name='Crushed Insect & The Sick Puppy', ), discograph.library.mongo.ArtistReference( name='Puente Latino', ), discograph.library.mongo.ArtistReference( name='Yakari & Delano', ), ], discogs_id=2, members=[ discograph.library.mongo.ArtistReference( discogs_id=26, name='Alexi Delano', ), discograph.library.mongo.ArtistReference( discogs_id=27, name='Cari Lekebusch', ), ], name='Mr. James Barth & A.D.', name_variations=[ 'Mr Barth & A.D.', 'MR JAMES BARTH & A. D.', 'Mr. Barth & A.D.', 'Mr. James Barth & A. D.', ], real_name='Cari Lekebusch & Alexi Delano', ) ''') assert actual == expected