def test_zip_x(self): names = set(split_artists('손동운 (하이라이트) X 서령 (공원소녀) [Son Dongwoon (Highlight) X Seoryoung (GWSN)]')) expected = { Name('Son Dongwoon', '손동운', extra={'group': Name('Highlight', '하이라이트')}), Name('Seoryoung', '서령', extra={'group': Name('GWSN', '공원소녀')}) } self.assertArtistsEqual(names, expected)
def test_name_part_reset(self): name = Name('foo') self.assertEqual(name._english, 'foo') self.assertEqual(name.english, 'foo') name._english = 'bar' self.assertEqual(name._english, 'bar') self.assertEqual(name.english, 'bar')
def test_zip_mix(self): names = set(split_artists('기희현, 전소미, 최유정, 김청하 (Heehyun (DIA), Somi, Yoo Jung, Chungha)')) expected = { Name('Heehyun', '기희현', extra={'group': Name('DIA')}), Name('Somi', '전소미'), Name('Yoo Jung', '최유정'), Name('Chungha', '김청하') } self.assertArtistsEqual(names, expected)
def test_solo_artist(self): page = self._make_root( """==Profile==\n*'''Name:''' 조이 / Joy\n*'''Real name:''' 박수영 / Park Soo Young\n*'''Profession:''' Singer, actress\n""" ) names = set(parse_dw_artist_name(page)) self.assertNamesEqual( names, {Name('Joy', '조이'), Name('Park Soo Young', '박수영')})
def test_multi_non_eng(self): intro = as_node( """'''BTS''' (Korean: 방탄소년단; Japanese: 防弾少年团; also known as '''Bangtan Boys''' and '''Beyond the Scene''') is a seven-member boy group under [[Big Hit Entertainment]]. They debuted on June 13, 2013 with their first single ''[[2 Cool 4 Skool]]''.""" ) names = name_from_intro(fake_page(intro)) self.assertNamesEqual( names, {Name('BTS', '방탄소년단'), Name('BTS', '防弾少年团')})
def test_with_romanization(self): page = self._make_root( """==Profile==\n*'''Name:''' 김청하 / Kim Chung Ha (Gim Cheong Ha)\n*'''Real name:''' 김찬미 / Kim Chan Mi\n*'''English name:''' Annie Kim\n*'''Also known as:''' Chungha, CHUNG HA\n""" ) names = set(parse_dw_artist_name(page)) self.assertNamesEqual( names, { Name('Kim Chung Ha', '김청하', romanized='Gim Cheong Ha'), Name('Kim Chan Mi', '김찬미') })
def test_multi_and(self): intro = as_node( """'''Girls' Generation''' (소녀시대 (''So Nyeo Si Dae'' or ''SNSD'') in Korea, and 少女時代 (''Shoujo Jidai'') in Japan) is a [[K-Pop|Korean pop]] girl group formed by [[SM Entertainment]]. Prior to their debut, they were described as the female [[Super Junior]] by [[SM Entertainment]]. They became well known after their hit 2009 song "[[Gee (song)|Gee]]". """ ) names = name_from_intro(fake_page(intro)) expected = { Name('Girls\' Generation', '소녀시대', romanized='So Nyeo Si Dae', versions={Name('SNSD', '소녀시대', romanized='So Nyeo Si Dae')}), Name('Girls\' Generation', '少女時代', romanized='Shoujo Jidai'), } self.assertNamesEqual(names, expected)
def test_from_parens_basic(self): name = Name.from_enclosed('Taeyeon (태연)') self.assertAll(name, _english='Taeyeon', english='Taeyeon', non_eng='태연', korean='태연')
def test_eng_cjk_feat(self): entry = as_node(""""Winter Flower (雪中梅) (feat. [[RM]])" - 3:41""", root=self.root) name = parse_kf_track_name(entry) self.assertNamesEqual( name, Name('Winter Flower', '雪中梅', extra={'length': '3:41', 'feat': as_node("""[[RM]]""", root=self.root)}) )
def test_unzipped_collabs(self): entry = as_node("""[[7989]] ([[Kangta]] & [[Taeyeon]] (강타&태연))""", root=self.root) name = parse_generasia_track_name(entry) expected = Name( '7989', extra={'artists': as_node("""( [[Kangta]] & [[Taeyeon]] (강타&태연))""", root=self.root)} ) self.assertNamesEqual(name, expected)
def test_name_part_reset_via_setattr(self): name = Name('foo') self.assertEqual(name._english, 'foo') self.assertEqual(name.english, 'foo') setattr(name, '_english', 'bar') self.assertEqual(name._english, 'bar') self.assertEqual(name.english, 'bar')
def test_feat_link_inside_quotes(self): entry = as_node(""""Starry Night (feat. [[Crush (singer)|Crush]])" - 3:31""", root=self.root) name = parse_kf_track_name(entry) self.assertNamesEqual( name, Name('Starry Night', extra={ 'length': '3:31', 'feat': as_node("""[[Crush (singer)|Crush]]""", root=self.root) }) )
def test_big_list_keep_parens(self): names = set(split_artists('현아 (HyunA), 조권 (Jo Kwon), 비투비 (BTOB), CLC, 펜타곤 (PENTAGON), 유선호 (Yu Seon Ho), (여자)아이들 [(G)I-DLE]')) expected = { Name('HyunA', '현아'), Name('Jo Kwon', '조권'), Name('BTOB', '비투비'), Name('CLC'), Name('PENTAGON', '펜타곤'), Name('Yu Seon Ho', '유선호'), Name('(G)I-DLE', '(여자)아이들') } self.assertArtistsEqual(names, expected)
def test_single_feat(self): page = self._fake_page( """"'''Eight'''" (에잇) is the seventh digital single by [[IU]]. It was released on May 6, 2020 and features [[Suga]].""", """{{Infobox single\n| name = Eight\n| artist = [[IU]] {{small\n|(feat. [[Suga]])\n}}\n| released = May 6, 2020\n| length = 2:47\n}}""", title='Eight', categories={'single article stubs', 'singles', 'digital singles', 'iu', '2020 releases', '2020 digital singles'} ) de = DiscographyEntry('Eight', {self._site: page}) parts = list(de.parts()) self.assertEqual(len(parts), 1) part = parts[0] tracks = part.tracks self.assertEqual(len(tracks), 1) track = tracks[0] self.assertNamesEqual( track.name, Name('Eight', '에잇', extra={'length': '2:47', 'feat': Link.from_title('Suga', page)}) ) self.assertEqual(track.full_name(), 'Eight (에잇) (feat. Suga (슈가))')
def test_group_previously(self): intro = as_node( """'''MAMAMOO''' (마마무; previously stylized in lowercase) is a [[K-Pop|Korean pop]]/[[K-R&B|R&B]] girl group that debuted in 2014 under [[RBW Entertainment]].""" ) names = name_from_intro(fake_page(intro)) self.assertNamesEqual(names, {Name('MAMAMOO', '마마무')})
def test_multiple_versions(self): entry = as_node(""""Wonderful Love (EDM Version) -Japanese ver.-" - 3:26""", root=self.root) name = parse_kf_track_name(entry) self.assertNamesEqual( name, Name('Wonderful Love', extra={'length': '3:26', 'version': ['EDM Version', 'Japanese ver.']}) )
def test_no_non_eng(self): intro = as_node( """'''RM''' (short for Real Me<ref>[https://www.etonline.com/bts-answers-fans-biggest-burning-questions-and-rm-reveals-why-he-changed-his-name-rap-monster-91173 BTS Answers Fans' Biggest Burning Questions – And RM Reveals Why He Changed His Name From Rap Monster!]</ref>, formerly '''Rap Monster''') is a South Korean rapper-songwriter, composer and producer under [[Big Hit Entertainment]]. He is the leader and main rapper of the boy group [[BTS]].""" ) names = name_from_intro(fake_page(intro)) self.assertNamesEqual(names, {Name('RM')})
def test_name_with_space(self): intro = as_node( """'''Red Velvet''' (레드벨벳) is a five-member girl group under [[SM Entertainment]]. They debuted as four on August 1, 2014 with the single "[[Happiness]]". [[Yeri (Red Velvet)|Yeri]] was added on the group in March 2015.""" ) names = name_from_intro(fake_page(intro)) self.assertNamesEqual(names, {Name('Red Velvet', '레드벨벳')})
def test_dash_enclosed_japanese_ver(self): entry = as_node(""""[[BBoom BBoom (single)|BBoom BBoom -Japanese ver.-]]" - 3:30""", root=self.root) name = parse_kf_track_name(entry) self.assertNamesEqual(name, Name('BBoom BBoom', extra={'length': '3:30', 'version': 'Japanese ver.'}))
def test_unpaired_quote(self): entry = as_node(""""A Song From The Past (이 노랜 꽤 오래된 거야) - 3:55""", root=self.root) name = parse_kf_track_name(entry) self.assertNamesEqual(name, Name('A Song From The Past', '이 노랜 꽤 오래된 거야', extra={'length': '3:55'}))
def test_acoustic_rnb_version(self): entry = as_node(""""☆★☆''' (별별별)'''" '''(Acoustic R&B Version)''' - 4:28""", root=self.root) name = parse_kf_track_name(entry) self.assertNamesEqual(name, Name('☆★☆', '별별별', extra={'length': '4:28', 'version': 'Acoustic R&B Version'}))
'Single `Catch Me If You Can`': AlbumName('Catch Me If You Can', alb_type='Single'), 'Chocolate Love (Digital single)': AlbumName('Chocolate Love', alb_type='Digital single'), 'The Red [1st Album]': AlbumName('The Red', alb_num='1st Album', alb_type='Album'), '#Cookie Jar [1st Japanese Mini Album]': AlbumName('#Cookie Jar', alb_num='1st Japanese Mini Album', alb_type='Japanese Mini Album'), 'PIRI~笛を吹け~-Japanese ver.-': AlbumName(('PIRI', '笛を吹け'), version='Japanese ver.'), 'SUMMER SPECIAL Pinocchio / Hot Summer': AlbumName('Pinocchio / Hot Summer', alb_type='SUMMER SPECIAL'), 'UP&DOWN[JAPANESE VERSION]SPECIAL EDITION - EP': AlbumName('UP&DOWN', alb_type='EP', edition='SPECIAL EDITION', version='JAPANESE VERSION'), '好きと言わせたい [Type-A]': AlbumName(('好きと言わせたい', 'Type-A')), '好きと言わせたい [WIZ*ONE Edition]': AlbumName('好きと言わせたい', edition='WIZ*ONE Edition'), 'Danger (Japanese Ver.)': AlbumName('Danger', version='Japanese Ver.'), 'The Best (New Edition)': AlbumName('The Best', edition='New Edition'), 'Kissing You (Rhythmer Remix Vol.1)': AlbumName('Kissing You', remix='Rhythmer Remix Vol.1'), 'I Feel You (CHN Ver.)': AlbumName('I Feel You', version='CHN Ver.'), 'Make It Right (feat. Lauv) (EDM Remix)': AlbumName('Make It Right', feat=(Name('Lauv'),), remix='EDM Remix'), 'Wannabe (Feat. San E)': AlbumName('Wannabe', feat=(Name('San E'),)), "2019 월간 윤종신 5월호 '별책부록' (Monthly Project 2019 May Yoon Jong Shin with TAEYEON)": AlbumName(('2019 월간 윤종신 5월호', '별책부록', 'Monthly Project 2019 May Yoon Jong Shin with TAEYEON')), '임재범 30주년 기념 앨범 Project 1': AlbumName('임재범 30주년 기념 앨범 Project 1'), '[Re:flower] PROJECT #1': AlbumName('Re:flower (PROJECT #1)'), '2001-2009 End And..': AlbumName('2001-2009 End And..'), '4집 Super Star': AlbumName('4집 Super Star'), 'OH MY GIRL JAPAN DEBUT ALBUM': AlbumName('OH MY GIRL JAPAN DEBUT ALBUM'), '화양연화 Young Forever': AlbumName('화양연화 Young Forever'), 'Thanks Edition `바람`': AlbumName('바람', edition='Thanks Edition'), '썸타 (Lil` Something)': AlbumName(('썸타', "Lil' Something")), 'Puberty Book I Bom (사춘기집I 꽃기운)': AlbumName(('Puberty Book I Bom', '사춘기집I 꽃기운')), 'Ah Yeah (아예)': AlbumName(('Ah Yeah', '아예')),
def test_solo_artist(self): intro = as_node( """'''BUMKEY''' (범키) is a [[K-Pop|Korean pop]]/[[K-Hip-Hop|hip-hop]] artist that debuted in 2010 under [[Brand New Music (label)|Brand New Music]]. He was a member of the [[K-Hip-Hop|hip-hop]] duo [[2winS]] and of the boy group [[TROY]]. He also participated in the special unit [[Group of 20]].""" ) names = name_from_intro(fake_page(intro)) self.assertNamesEqual(names, {Name('BUMKEY', '범키')})
def test_name_with_stylized(self): intro = as_node( """'''BLACKPINK''' (블랙핑크; stylized as '''BLΛƆKPIИK''') is a four-member girl group under [[YG Entertainment]]. They debuted on August 8, 2016 with their digital single album "[[Square One]]".""" ) names = name_from_intro(fake_page(intro)) self.assertNamesEqual(names, {Name('BLACKPINK', '블랙핑크')})
def test_comma_in_parens(self): intro = as_node( """'''OH MY GIRL''' (오마이걸, also stylized as OMG) is a seven-member girl group under [[WM Entertainment]]. They debuted on April 21, 2015 with the song "Cupid" from their first [[Oh My Girl (album)|self-titled mini album]].""" ) names = name_from_intro(fake_page(intro)) self.assertNamesEqual(names, {Name('OH MY GIRL', '오마이걸')})
def test_multiple_versions_repr(self): name = Name('Wonderful Love', extra={'length': '3:26', 'version': ['EDM Version', 'Japanese ver.']}) track = Track(7, name, None) self.assertEqual(track.full_name(collabs=True), 'Wonderful Love (EDM Version) (Japanese ver.)')
def test_remix_feat(self): entry = as_node("""[[Bad Girl (Girls' Generation)|BAD GIRL (The Cataracs Remix)]] feat. [[DEV]]""", root=self.root) name = parse_generasia_track_name(entry) self.assertNamesEqual( name, Name('BAD GIRL', extra={'remix': 'The Cataracs Remix', 'feat': as_node("""[[DEV]]""", root=self.root)}) )
def test_from_parens_with_nested(self): name = Name.from_enclosed('(G)I-DLE ((여자)아이들)') self.assertAll(name, '(G)I-DLE', '(G)I-DLE', '(여자)아이들', '(여자)아이들')
def test_eng_han_rom_lit_track(self): entry = as_node("""[[Perfect for You (Sowon)|Honey (Sowon)]] (소원; ''Wish'')""", root=self.root) name = parse_generasia_track_name(entry) self.assertNamesEqual(name, Name('Honey', '소원', romanized='Sowon', lit_translation='Wish'))
def test_match_on_non_eng(self): name_1 = Name(non_eng='알고 싶어', lit_translation='I Want to Know') name_2 = Name('What\'s in Your House?', '알고 싶어') self.assertTrue(name_1.matches(name_2)) self.assertTrue(name_2.matches(name_1))