<s> """<STR_LIT>""" <EOL> from __future__ import division , absolute_import , print_function <EOL> from test import _common <EOL> from test . _common import unittest <EOL> from beets . autotag import mb <EOL> from beets import config <EOL> import mock <EOL> class MBAlbumInfoTest ( _common . TestCase ) : <EOL> def _make_release ( self , date_str = '<STR_LIT>' , tracks = None , track_length = None , <EOL> track_artist = False ) : <EOL> release = { <EOL> '<STR_LIT:title>' : '<STR_LIT>' , <EOL> '<STR_LIT:id>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:type>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : date_str , <EOL> '<STR_LIT:id>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , <EOL> '<STR_LIT>' : [ <EOL> { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:id>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> } <EOL> ] , <EOL> '<STR_LIT:date>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : [ ] , <EOL> '<STR_LIT>' : [ { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:label>' : { '<STR_LIT:name>' : '<STR_LIT>' } , <EOL> } ] , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:status>' : '<STR_LIT>' , <EOL> } <EOL> if tracks : <EOL> track_list = [ ] <EOL> for i , recording in enumerate ( tracks ) : <EOL> track = { <EOL> '<STR_LIT>' : recording , <EOL> '<STR_LIT>' : bytes ( i + <NUM_LIT:1> ) , <EOL> } <EOL> if track_length : <EOL> track [ '<STR_LIT>' ] = track_length <EOL> if track_artist : <EOL> track [ '<STR_LIT>' ] = [ <EOL> { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:id>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> } <EOL> ] <EOL> track_list . append ( track ) <EOL> release [ '<STR_LIT>' ] . append ( { <EOL> '<STR_LIT>' : '<STR_LIT:1>' , <EOL> '<STR_LIT>' : track_list , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT:title>' : '<STR_LIT>' , <EOL> } ) <EOL> return release <EOL> def _make_track ( self , title , tr_id , duration , artist = False ) : <EOL> track = { <EOL> '<STR_LIT:title>' : title , <EOL> '<STR_LIT:id>' : tr_id , <EOL> } <EOL> if duration is not None : <EOL> track [ '<STR_LIT>' ] = duration <EOL> if artist : <EOL> track [ '<STR_LIT>' ] = [ <EOL> { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:id>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } , <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> } <EOL> ] <EOL> return track <EOL> def test_parse_release_with_year ( self ) : <EOL> release = self . _make_release ( '<STR_LIT>' ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . album , '<STR_LIT>' ) <EOL> self . assertEqual ( d . album_id , '<STR_LIT>' ) <EOL> self . assertEqual ( d . artist , '<STR_LIT>' ) <EOL> self . assertEqual ( d . artist_id , '<STR_LIT>' ) <EOL> self . assertEqual ( d . original_year , <NUM_LIT> ) <EOL> self . assertEqual ( d . year , <NUM_LIT> ) <EOL> self . assertEqual ( d . artist_credit , '<STR_LIT>' ) <EOL> def test_parse_release_type ( self ) : <EOL> release = self . _make_release ( '<STR_LIT>' ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . albumtype , '<STR_LIT>' ) <EOL> def test_parse_release_full_date ( self ) : <EOL> release = self . _make_release ( '<STR_LIT>' ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . original_year , <NUM_LIT> ) <EOL> self . assertEqual ( d . original_month , <NUM_LIT:3> ) <EOL> self . assertEqual ( d . original_day , <NUM_LIT> ) <EOL> def test_parse_tracks ( self ) : <EOL> tracks = [ self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> * <NUM_LIT> ) , <EOL> self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> * <NUM_LIT> ) ] <EOL> release = self . _make_release ( tracks = tracks ) <EOL> d = mb . album_info ( release ) <EOL> t = d . tracks <EOL> self . assertEqual ( len ( t ) , <NUM_LIT:2> ) <EOL> self . assertEqual ( t [ <NUM_LIT:0> ] . title , '<STR_LIT>' ) <EOL> self . assertEqual ( t [ <NUM_LIT:0> ] . track_id , '<STR_LIT>' ) <EOL> self . assertEqual ( t [ <NUM_LIT:0> ] . length , <NUM_LIT> ) <EOL> self . assertEqual ( t [ <NUM_LIT:1> ] . title , '<STR_LIT>' ) <EOL> self . assertEqual ( t [ <NUM_LIT:1> ] . track_id , '<STR_LIT>' ) <EOL> self . assertEqual ( t [ <NUM_LIT:1> ] . length , <NUM_LIT> ) <EOL> def test_parse_track_indices ( self ) : <EOL> tracks = [ self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> * <NUM_LIT> ) , <EOL> self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> * <NUM_LIT> ) ] <EOL> release = self . _make_release ( tracks = tracks ) <EOL> d = mb . album_info ( release ) <EOL> t = d . tracks <EOL> self . assertEqual ( t [ <NUM_LIT:0> ] . medium_index , <NUM_LIT:1> ) <EOL> self . assertEqual ( t [ <NUM_LIT:0> ] . index , <NUM_LIT:1> ) <EOL> self . assertEqual ( t [ <NUM_LIT:1> ] . medium_index , <NUM_LIT:2> ) <EOL> self . assertEqual ( t [ <NUM_LIT:1> ] . index , <NUM_LIT:2> ) <EOL> def test_parse_medium_numbers_single_medium ( self ) : <EOL> tracks = [ self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> * <NUM_LIT> ) , <EOL> self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> * <NUM_LIT> ) ] <EOL> release = self . _make_release ( tracks = tracks ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . mediums , <NUM_LIT:1> ) <EOL> t = d . tracks <EOL> self . assertEqual ( t [ <NUM_LIT:0> ] . medium , <NUM_LIT:1> ) <EOL> self . assertEqual ( t [ <NUM_LIT:1> ] . medium , <NUM_LIT:1> ) <EOL> def test_parse_medium_numbers_two_mediums ( self ) : <EOL> tracks = [ self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> * <NUM_LIT> ) , <EOL> self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> * <NUM_LIT> ) ] <EOL> release = self . _make_release ( tracks = [ tracks [ <NUM_LIT:0> ] ] ) <EOL> second_track_list = [ { <EOL> '<STR_LIT>' : tracks [ <NUM_LIT:1> ] , <EOL> '<STR_LIT>' : '<STR_LIT:1>' , <EOL> } ] <EOL> release [ '<STR_LIT>' ] . append ( { <EOL> '<STR_LIT>' : '<STR_LIT:2>' , <EOL> '<STR_LIT>' : second_track_list , <EOL> } ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . mediums , <NUM_LIT:2> ) <EOL> t = d . tracks <EOL> self . assertEqual ( t [ <NUM_LIT:0> ] . medium , <NUM_LIT:1> ) <EOL> self . assertEqual ( t [ <NUM_LIT:0> ] . medium_index , <NUM_LIT:1> ) <EOL> self . assertEqual ( t [ <NUM_LIT:0> ] . index , <NUM_LIT:1> ) <EOL> self . assertEqual ( t [ <NUM_LIT:1> ] . medium , <NUM_LIT:2> ) <EOL> self . assertEqual ( t [ <NUM_LIT:1> ] . medium_index , <NUM_LIT:1> ) <EOL> self . assertEqual ( t [ <NUM_LIT:1> ] . index , <NUM_LIT:2> ) <EOL> def test_parse_release_year_month_only ( self ) : <EOL> release = self . _make_release ( '<STR_LIT>' ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . original_year , <NUM_LIT> ) <EOL> self . assertEqual ( d . original_month , <NUM_LIT:3> ) <EOL> def test_no_durations ( self ) : <EOL> tracks = [ self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , None ) ] <EOL> release = self . _make_release ( tracks = tracks ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . tracks [ <NUM_LIT:0> ] . length , None ) <EOL> def test_track_length_overrides_recording_length ( self ) : <EOL> tracks = [ self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT:1.0> * <NUM_LIT> ) ] <EOL> release = self . _make_release ( tracks = tracks , track_length = <NUM_LIT> * <NUM_LIT> ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . tracks [ <NUM_LIT:0> ] . length , <NUM_LIT> ) <EOL> def test_no_release_date ( self ) : <EOL> release = self . _make_release ( None ) <EOL> d = mb . album_info ( release ) <EOL> self . assertFalse ( d . original_year ) <EOL> self . assertFalse ( d . original_month ) <EOL> self . assertFalse ( d . original_day ) <EOL> def test_various_artists_defaults_false ( self ) : <EOL> release = self . _make_release ( None ) <EOL> d = mb . album_info ( release ) <EOL> self . assertFalse ( d . va ) <EOL> def test_detect_various_artists ( self ) : <EOL> release = self . _make_release ( None ) <EOL> release [ '<STR_LIT>' ] [ <NUM_LIT:0> ] [ '<STR_LIT>' ] [ '<STR_LIT:id>' ] = mb . VARIOUS_ARTISTS_ID <EOL> d = mb . album_info ( release ) <EOL> self . assertTrue ( d . va ) <EOL> def test_parse_artist_sort_name ( self ) : <EOL> release = self . _make_release ( None ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . artist_sort , '<STR_LIT>' ) <EOL> def test_parse_releasegroupid ( self ) : <EOL> release = self . _make_release ( None ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . releasegroup_id , '<STR_LIT>' ) <EOL> def test_parse_asin ( self ) : <EOL> release = self . _make_release ( None ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . asin , '<STR_LIT>' ) <EOL> def test_parse_catalognum ( self ) : <EOL> release = self . _make_release ( None ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . catalognum , '<STR_LIT>' ) <EOL> def test_parse_textrepr ( self ) : <EOL> release = self . _make_release ( None ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . script , '<STR_LIT>' ) <EOL> self . assertEqual ( d . language , '<STR_LIT>' ) <EOL> def test_parse_country ( self ) : <EOL> release = self . _make_release ( None ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . country , '<STR_LIT>' ) <EOL> def test_parse_status ( self ) : <EOL> release = self . _make_release ( None ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . albumstatus , '<STR_LIT>' ) <EOL> def test_parse_media ( self ) : <EOL> tracks = [ self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> * <NUM_LIT> ) , <EOL> self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> * <NUM_LIT> ) ] <EOL> release = self . _make_release ( None , tracks = tracks ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . media , '<STR_LIT>' ) <EOL> def test_parse_disambig ( self ) : <EOL> release = self . _make_release ( None ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . albumdisambig , <EOL> '<STR_LIT>' ) <EOL> def test_parse_disctitle ( self ) : <EOL> tracks = [ self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> * <NUM_LIT> ) , <EOL> self . _make_track ( '<STR_LIT>' , '<STR_LIT>' , <NUM_LIT> * <NUM_LIT> ) ] <EOL> release = self . _make_release ( None , tracks = tracks ) <EOL> d = mb . album_info ( release ) <EOL> t = d . tracks <EOL> self . assertEqual ( t [ <NUM_LIT:0> ] . disctitle , '<STR_LIT>' ) <EOL> self . assertEqual ( t [ <NUM_LIT:1> ] . disctitle , '<STR_LIT>' ) <EOL> def test_missing_language ( self ) : <EOL> release = self . _make_release ( None ) <EOL> del release [ '<STR_LIT>' ] [ '<STR_LIT>' ] <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . language , None ) <EOL> def test_parse_recording_artist ( self ) : <EOL> tracks = [ self . _make_track ( '<STR_LIT:a>' , '<STR_LIT:b>' , <NUM_LIT:1> , True ) ] <EOL> release = self . _make_release ( None , tracks = tracks ) <EOL> track = mb . album_info ( release ) . tracks [ <NUM_LIT:0> ] <EOL> self . assertEqual ( track . artist , '<STR_LIT>' ) <EOL> self . assertEqual ( track . artist_id , '<STR_LIT>' ) <EOL> self . assertEqual ( track . artist_sort , '<STR_LIT>' ) <EOL> self . assertEqual ( track . artist_credit , '<STR_LIT>' ) <EOL> def test_track_artist_overrides_recording_artist ( self ) : <EOL> tracks = [ self . _make_track ( '<STR_LIT:a>' , '<STR_LIT:b>' , <NUM_LIT:1> , True ) ] <EOL> release = self . _make_release ( None , tracks = tracks , track_artist = True ) <EOL> track = mb . album_info ( release ) . tracks [ <NUM_LIT:0> ] <EOL> self . assertEqual ( track . artist , '<STR_LIT>' ) <EOL> self . assertEqual ( track . artist_id , '<STR_LIT>' ) <EOL> self . assertEqual ( track . artist_sort , '<STR_LIT>' ) <EOL> self . assertEqual ( track . artist_credit , '<STR_LIT>' ) <EOL> def test_data_source ( self ) : <EOL> release = self . _make_release ( ) <EOL> d = mb . album_info ( release ) <EOL> self . assertEqual ( d . data_source , '<STR_LIT>' ) <EOL> class ParseIDTest ( _common . TestCase ) : <EOL> def test_parse_id_correct ( self ) : <EOL> id_string = "<STR_LIT>" <EOL> out = mb . _parse_id ( id_string ) <EOL> self . assertEqual ( out , id_string ) <EOL> def test_parse_id_non_id_returns_none ( self ) : <EOL> id_string = "<STR_LIT>" <EOL> out = mb . _parse_id ( id_string ) <EOL> self . assertEqual ( out , None ) <EOL> def test_parse_id_url_finds_id ( self ) : <EOL> id_string = "<STR_LIT>" <EOL> id_url = "<STR_LIT>" % id_string <EOL> out = mb . _parse_id ( id_url ) <EOL> self . assertEqual ( out , id_string ) <EOL> class ArtistFlatteningTest ( _common . TestCase ) : <EOL> def _credit_dict ( self , suffix = '<STR_LIT>' ) : <EOL> return { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:name>' : '<STR_LIT>' + suffix , <EOL> '<STR_LIT>' : '<STR_LIT>' + suffix , <EOL> } , <EOL> '<STR_LIT:name>' : '<STR_LIT>' + suffix , <EOL> } <EOL> def _add_alias ( self , credit_dict , suffix = '<STR_LIT>' , locale = '<STR_LIT>' , primary = False ) : <EOL> alias = { <EOL> '<STR_LIT>' : '<STR_LIT>' + suffix , <EOL> '<STR_LIT>' : locale , <EOL> '<STR_LIT>' : '<STR_LIT>' + suffix <EOL> } <EOL> if primary : <EOL> alias [ '<STR_LIT>' ] = '<STR_LIT>' <EOL> if '<STR_LIT>' not in credit_dict [ '<STR_LIT>' ] : <EOL> credit_dict [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ ] <EOL> credit_dict [ '<STR_LIT>' ] [ '<STR_LIT>' ] . append ( alias ) <EOL> def test_single_artist ( self ) : <EOL> a , s , c = mb . _flatten_artist_credit ( [ self . _credit_dict ( ) ] ) <EOL> self . assertEqual ( a , '<STR_LIT>' ) <EOL> self . assertEqual ( s , '<STR_LIT>' ) <EOL> self . assertEqual ( c , '<STR_LIT>' ) <EOL> def test_two_artists ( self ) : <EOL> a , s , c = mb . _flatten_artist_credit ( <EOL> [ self . _credit_dict ( '<STR_LIT:a>' ) , '<STR_LIT>' , self . _credit_dict ( '<STR_LIT:b>' ) ] <EOL> ) <EOL> self . assertEqual ( a , '<STR_LIT>' ) <EOL> self . assertEqual ( s , '<STR_LIT>' ) <EOL> self . assertEqual ( c , '<STR_LIT>' ) <EOL> def test_alias ( self ) : <EOL> credit_dict = self . _credit_dict ( ) <EOL> self . _add_alias ( credit_dict , suffix = '<STR_LIT>' , locale = '<STR_LIT>' , primary = True ) <EOL> self . _add_alias ( credit_dict , suffix = '<STR_LIT>' , locale = '<STR_LIT>' , <EOL> primary = True ) <EOL> self . _add_alias ( credit_dict , suffix = '<STR_LIT>' , locale = '<STR_LIT>' ) <EOL> self . _add_alias ( credit_dict , suffix = '<STR_LIT>' , locale = '<STR_LIT>' , primary = True ) <EOL> self . _add_alias ( credit_dict , suffix = '<STR_LIT>' , locale = '<STR_LIT>' ) <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ '<STR_LIT>' ] <EOL> flat = mb . _flatten_artist_credit ( [ credit_dict ] ) <EOL> self . assertEqual ( flat , ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ '<STR_LIT>' ] <EOL> flat = mb . _flatten_artist_credit ( [ credit_dict ] ) <EOL> self . assertEqual ( flat , ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> flat = mb . _flatten_artist_credit ( [ credit_dict ] ) <EOL> self . assertEqual ( flat , ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> flat = mb . _flatten_artist_credit ( [ credit_dict ] ) <EOL> self . assertEqual ( flat , ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ '<STR_LIT>' ] <EOL> flat = mb . _flatten_artist_credit ( [ credit_dict ] ) <EOL> self . assertEqual ( flat , ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> config [ '<STR_LIT>' ] [ '<STR_LIT>' ] = [ '<STR_LIT>' , '<STR_LIT>' ] <EOL> flat = mb . _flatten_artist_credit ( [ credit_dict ] ) <EOL> self . assertEqual ( flat , ( '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ) ) <EOL> class MBLibraryTest ( unittest . TestCase ) : <EOL> def test_match_track ( self ) : <EOL> with mock . patch ( '<STR_LIT>' ) as p : <EOL> p . return_value = { <EOL> '<STR_LIT>' : [ { <EOL> '<STR_LIT:title>' : '<STR_LIT:foo>' , <EOL> '<STR_LIT:id>' : '<STR_LIT:bar>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> } ] , <EOL> } <EOL> ti = list ( mb . match_track ( '<STR_LIT:hello>' , '<STR_LIT>' ) ) [ <NUM_LIT:0> ] <EOL> p . assert_called_with ( artist = '<STR_LIT:hello>' , recording = '<STR_LIT>' , limit = <NUM_LIT:5> ) <EOL> self . assertEqual ( ti . title , '<STR_LIT:foo>' ) <EOL> self . assertEqual ( ti . track_id , '<STR_LIT:bar>' ) <EOL> def test_match_album ( self ) : <EOL> mbid = '<STR_LIT>' <EOL> with mock . patch ( '<STR_LIT>' ) as sp : <EOL> sp . return_value = { <EOL> '<STR_LIT>' : [ { <EOL> '<STR_LIT:id>' : mbid , <EOL> } ] , <EOL> } <EOL> with mock . patch ( '<STR_LIT>' ) as gp : <EOL> gp . return_value = { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:title>' : '<STR_LIT>' , <EOL> '<STR_LIT:id>' : mbid , <EOL> '<STR_LIT>' : [ { <EOL> '<STR_LIT>' : [ { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:title>' : '<STR_LIT:foo>' , <EOL> '<STR_LIT:id>' : '<STR_LIT:bar>' , <EOL> '<STR_LIT>' : <NUM_LIT> , <EOL> } , <EOL> '<STR_LIT>' : <NUM_LIT:9> , <EOL> } ] , <EOL> '<STR_LIT>' : <NUM_LIT:5> , <EOL> } ] , <EOL> '<STR_LIT>' : [ { <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:name>' : '<STR_LIT>' , <EOL> '<STR_LIT:id>' : '<STR_LIT>' , <EOL> } , <EOL> } ] , <EOL> '<STR_LIT>' : { <EOL> '<STR_LIT:id>' : '<STR_LIT>' , <EOL> } <EOL> } <EOL> } <EOL> ai = list ( mb . match_album ( '<STR_LIT:hello>' , '<STR_LIT>' ) ) [ <NUM_LIT:0> ] <EOL> sp . assert_called_with ( artist = '<STR_LIT:hello>' , release = '<STR_LIT>' , limit = <NUM_LIT:5> ) <EOL> gp . assert_called_with ( mbid , mock . ANY ) <EOL> self . assertEqual ( ai . tracks [ <NUM_LIT:0> ] . title , '<STR_LIT:foo>' ) <EOL> self . assertEqual ( ai . album , '<STR_LIT>' ) <EOL> def test_match_track_empty ( self ) : <EOL> with mock . patch ( '<STR_LIT>' ) as p : <EOL> til = list ( mb . match_track ( '<STR_LIT:U+0020>' , '<STR_LIT:U+0020>' ) ) <EOL> self . assertFalse ( p . called ) <EOL> self . assertEqual ( til , [ ] ) <EOL> def test_match_album_empty ( self ) : <EOL> with mock . patch ( '<STR_LIT>' ) as p : <EOL> ail = list ( mb . match_album ( '<STR_LIT:U+0020>' , '<STR_LIT:U+0020>' ) ) <EOL> self . assertFalse ( p . called ) <EOL> self . assertEqual ( ail , [ ] ) <EOL> def suite ( ) : <EOL> return unittest . TestLoader ( ) . loadTestsFromName ( __name__ ) <EOL> if __name__ == b'<STR_LIT:__main__>' : <EOL> unittest . main ( defaultTest = '<STR_LIT>' ) </s>
