Пример #1
0
	def test_offenbach(self):
		offenbach_code = file(os.path.join(base, 'artist_offenbach.html'), 'r').read()
		offenbach = artist.parse_page(offenbach_code)
		self.assertEqual(u'Jacques Offenbach', offenbach['name'])
		self.assertEqual(u'male', offenbach['sex'])
		self.assertEqual('1819-06-20', offenbach['birthdate'])
		self.assertEqual('1880-10-05', offenbach['deathdate'])
Пример #2
0
 def test_nobuo(self):
     nobuo_code = file(os.path.join(base, "artist_nobuo.html"), "r").read()
     nobuo = artist.parse_page(nobuo_code)
     self.assertEqual(u"Nobuo Uematsu", nobuo["name"])
     self.assertEqual(u"male", nobuo["sex"])
     self.assertEqual(u"Mar 21, 1959", nobuo["info"]["Birthdate"])
     self.assertEqual("1959-03-21", nobuo["birthdate"])
     self.assertEqual(1, len(nobuo["info"]["Organizations"]))
     self.assertEqual(1, len(nobuo["organizations"]))
     self.assertEqual(u"Dog Ear Records", nobuo["info"]["Organizations"][0]["names"]["en"])
     self.assertEqual(u"Dog Ear Records", nobuo["organizations"][0]["names"]["en"])
     self.assertEqual(u"Individual", nobuo["type"])
     self.assertEqual(u"Earthbound Papas", nobuo["units"][0]["names"]["en"])
     self.assertEqual(u"CRUISE CHASER BLASSTY", nobuo["discography"][0]["titles"]["en"])
     self.assertEqual(u"album/11113", nobuo["discography"][0]["link"])
     self.assertEqual(u"album/719", nobuo["featured_on"][0]["link"])
     self.assertEqual(u"bonus", nobuo["discography"][0]["type"])
     self.assertEqual(u"1986-04-26", nobuo["discography"][0]["date"])
     self.assertEqual(u"H25X-20015", nobuo["discography"][2]["catalog"])
     self.assertTrue(u"Composer" in nobuo["discography"][0]["roles"])
     self.assertEqual(u"DOGEARRECORDS", nobuo["websites"]["Official"][0]["name"])
     self.assertEqual("UematsuNobuo", nobuo["twitter_names"][0])
     self.assertEqual("2007-10-17T09:14", nobuo["meta"]["added_date"])
     self.assertEqual("http://vgmdb.net/db/assets/portraits-medium/77-1345913713.jpg", nobuo["picture_small"])
     self.assertEqual("http://vgmdb.net/db/assets/portraits/77-1345913713.jpg", nobuo["picture_full"])
Пример #3
0
	def test_nobuo(self):
		nobuo_code = file(os.path.join(base, 'artist_nobuo.html'), 'r').read()
		nobuo = artist.parse_page(nobuo_code)
		self.assertEqual(u'Nobuo Uematsu', nobuo['name'])
		self.assertEqual(u'male', nobuo['sex'])
		self.assertEqual(u'Mar 21, 1959', nobuo['info']['Birthdate'])
		self.assertEqual('1959-03-21', nobuo['birthdate'])
		self.assertEqual(1, len(nobuo['info']['Organizations']))
		self.assertEqual(1, len(nobuo['organizations']))
		self.assertEqual(u'Dog Ear Records', nobuo['info']['Organizations'][0]['names']['en'])
		self.assertEqual(u'Dog Ear Records', nobuo['organizations'][0]['names']['en'])
		self.assertEqual(u'Individual', nobuo['type'])
		self.assertEqual(u'Earthbound Papas', nobuo['units'][0]['names']['en'])
		self.assertEqual(u'CRUISE CHASER BLASSTY', nobuo['discography'][0]['titles']['en'])
		self.assertEqual(u'album/11113', nobuo['discography'][0]['link'])
		self.assertEqual(u'album/719', nobuo['featured_on'][0]['link'])
		self.assertEqual(u'bonus', nobuo['discography'][0]['type'])
		self.assertEqual(u'1986-04-26', nobuo['discography'][0]['date'])
		self.assertEqual(u'H25X-20015', nobuo['discography'][2]['catalog'])
		self.assertTrue(u'Composer' in nobuo['discography'][0]['roles'])
		self.assertEqual(u'DOGEARRECORDS', nobuo['websites']['Official'][0]['name'])
		self.assertEqual('UematsuNobuo', nobuo['twitter_names'][0])
		self.assertEqual('2007-10-17T09:14', nobuo['meta']['added_date'])
		self.assertEqual('http://vgmdb.net/db/assets/portraits-medium/77-1345913713.jpg', nobuo['picture_small'])
		self.assertEqual('http://vgmdb.net/db/assets/portraits/77-1345913713.jpg', nobuo['picture_full'])
Пример #4
0
 def test_nobuo(self):
     nobuo_code = file(os.path.join(base, 'artist_nobuo.html'), 'r').read()
     nobuo = artist.parse_page(nobuo_code)
     self.assertEqual(u'Nobuo Uematsu', nobuo['name'])
     self.assertEqual(u'male', nobuo['sex'])
     self.assertEqual(u'Mar 21, 1959', nobuo['info']['Birthdate'])
     self.assertEqual('1959-03-21', nobuo['birthdate'])
     self.assertEqual(1, len(nobuo['info']['Organizations']))
     self.assertEqual(1, len(nobuo['organizations']))
     self.assertEqual(u'Dog Ear Records',
                      nobuo['info']['Organizations'][0]['names']['en'])
     self.assertEqual(u'Dog Ear Records',
                      nobuo['organizations'][0]['names']['en'])
     self.assertEqual(u'Individual', nobuo['type'])
     self.assertEqual(u'Earthbound Papas', nobuo['units'][0]['names']['en'])
     self.assertEqual(u'CRUISE CHASER BLASSTY',
                      nobuo['discography'][0]['titles']['en'])
     self.assertEqual(u'album/11113', nobuo['discography'][0]['link'])
     self.assertEqual(u'album/718', nobuo['featured_on'][0]['link'])
     self.assertEqual(u'bonus', nobuo['discography'][0]['type'])
     self.assertEqual(u'1986-04-26', nobuo['discography'][0]['date'])
     self.assertEqual(u'H25X-20015', nobuo['discography'][2]['catalog'])
     self.assertTrue(u'Composer' in nobuo['discography'][0]['roles'])
     self.assertEqual(u'DOGEARRECORDS',
                      nobuo['websites']['Official'][0]['name'])
     self.assertEqual('UematsuNobuo', nobuo['twitter_names'][0])
     self.assertEqual('2007-10-17T09:14', nobuo['meta']['added_date'])
     self.assertEqual(
         'https://thumb-media.vgm.io/artists/77/77/77-1345913713.jpg',
         nobuo['picture_small'])
     self.assertEqual(
         'https://media.vgm.io/artists/77/77/77-1345913713.jpg',
         nobuo['picture_full'])
Пример #5
0
	def test_ss(self):
		ss_code = file(os.path.join(base, 'artist_ss.html'), 'r').read()
		ss = artist.parse_page(ss_code)
		self.assertEqual(u'Composer (as HAPPY-SYNTHESIZER)', ss['discography'][12]['roles'][0])
		self.assertEqual(u'Arranger (as (S_S))', ss['discography'][13]['roles'][0])
		self.assertEqual(u'HAPPY-SYNTHESIZER', ss['aliases'][1]['names']['en'])
		self.assertEqual(u'Takeshi Nagai', ss['members'][0]['names']['en'])
		self.assertEqual(u'2011-10-03T05:45', ss['meta']['edited_date'])
Пример #6
0
 def test_key(self):
     key_code = file(os.path.join(base, "artist_key.html"), "r").read()
     key = artist.parse_page(key_code)
     self.assertEqual(u"Jun Maeda", key["name"])
     self.assertEqual(u"Individual", key["type"])
     self.assertEqual(u"male", key["sex"])
     self.assertEqual(1, len(key["aliases"]))
     self.assertEqual(u"KEY", key["aliases"][0]["names"]["en"])
Пример #7
0
 def test_key(self):
     key_code = file(os.path.join(base, 'artist_key.html'), 'r').read()
     key = artist.parse_page(key_code)
     self.assertEqual(u'Jun Maeda', key['name'])
     self.assertEqual(u'Individual', key['type'])
     self.assertEqual(u'male', key['sex'])
     self.assertEqual(1, len(key['aliases']))
     self.assertEqual(u'KEY', key['aliases'][0]['names']['en'])
Пример #8
0
 def test_offenbach(self):
     offenbach_code = file(os.path.join(base, "artist_offenbach.html"), "r").read()
     offenbach = artist.parse_page(offenbach_code)
     self.assertEqual(u"Jacques Offenbach", offenbach["name"])
     self.assertEqual(u"male", offenbach["sex"])
     self.assertEqual(u"Individual", offenbach["type"])
     self.assertEqual("1819-06-20", offenbach["birthdate"])
     self.assertEqual("1880-10-05", offenbach["deathdate"])
Пример #9
0
	def test_key(self):
		key_code = file(os.path.join(base, 'artist_key.html'), 'r').read()
		key = artist.parse_page(key_code)
		self.assertEqual(u'Jun Maeda', key['name'])
		self.assertEqual(u'Individual', key['type'])
		self.assertEqual(u'male', key['sex'])
		self.assertEqual(1, len(key['aliases']))
		self.assertEqual(u'KEY', key['aliases'][0]['names']['en'])
Пример #10
0
 def test_ss(self):
     ss_code = file(os.path.join(base, "artist_ss.html"), "r").read()
     ss = artist.parse_page(ss_code)
     self.assertEqual(u"Composer (as HAPPY-SYNTHESIZER)", ss["discography"][12]["roles"][0])
     self.assertEqual(u"Arranger (as (S_S))", ss["discography"][13]["roles"][0])
     self.assertEqual(u"HAPPY-SYNTHESIZER", ss["aliases"][1]["names"]["en"])
     self.assertEqual(u"Takeshi Nagai", ss["members"][0]["names"]["en"])
     self.assertEqual(u"2011-10-03T05:45", ss["meta"]["edited_date"])
     self.assertEqual(u"Unit", ss["type"])
Пример #11
0
 def test_offenbach(self):
     offenbach_code = file(os.path.join(base, 'artist_offenbach.html'),
                           'r').read()
     offenbach = artist.parse_page(offenbach_code)
     self.assertEqual(u'Jacques Offenbach', offenbach['name'])
     self.assertEqual(u'male', offenbach['sex'])
     self.assertEqual(u'Individual', offenbach['type'])
     self.assertEqual('1819-06-20', offenbach['birthdate'])
     self.assertEqual('1880-10-05', offenbach['deathdate'])
Пример #12
0
 def test_rookies(self):
     rookies_code = file(os.path.join(base, "artist_rookies.html"), "r").read()
     rookies = artist.parse_page(rookies_code)
     self.assertEqual(u"ROOKiEZ is PUNK'D", rookies["name"])
     self.assertEqual(3, len(rookies["info"]["Members"]))
     self.assertEqual(u"Unit", rookies["type"])
     self.assertFalse("link" in rookies["info"]["Members"][0])
     self.assertEqual(u"RYOTA", rookies["info"]["Members"][0]["names"]["en"])
     self.assertEqual(u"artist/15569", rookies["info"]["Members"][2]["link"])
     self.assertEqual(u"SHiNNOSUKE", rookies["info"]["Members"][2]["names"]["en"])
     self.assertFalse("link" in rookies["info"]["Former Members"][0])
     self.assertEqual(u"2RASH", rookies["info"]["Former Members"][0]["names"]["en"])
Пример #13
0
 def test_ss(self):
     ss_code = file(os.path.join(base, 'artist_ss.html'), 'r').read()
     ss = artist.parse_page(ss_code)
     self.assertEqual(u'Composer (as HAPPY-SYNTHESIZER)',
                      ss['discography'][13]['roles'][0])
     self.assertEqual(u'Arranger (as (S_S))',
                      ss['discography'][14]['roles'][0])
     self.assertEqual(u'DIRTY-SYNTHESIZER', ss['aliases'][1]['names']['en'])
     self.assertEqual(u'HAPPY-SYNTHESIZER', ss['aliases'][3]['names']['en'])
     self.assertEqual(u'Takeshi Nagai', ss['members'][0]['names']['en'])
     self.assertEqual(u'2011-10-03T05:45', ss['meta']['edited_date'])
     self.assertEqual(u'Unit', ss['type'])
Пример #14
0
	def test_rookies(self):
		rookies_code = file(os.path.join(base, 'artist_rookies.html'), 'r').read()
		rookies = artist.parse_page(rookies_code)
		self.assertEqual(u"ROOKiEZ is PUNK'D", rookies['name'])
		self.assertEqual(3, len(rookies['info']['Members']))
		self.assertEqual(u'Unit', rookies['type'])
		self.assertFalse('link' in rookies['info']['Members'][0])
		self.assertEqual(u'RYOTA', rookies['info']['Members'][0]['names']['en'])
		self.assertEqual(u'artist/15569', rookies['info']['Members'][2]['link'])
		self.assertEqual(u'SHiNNOSUKE', rookies['info']['Members'][2]['names']['en'])
		self.assertFalse('link' in rookies['info']['Former Members'][0])
		self.assertEqual(u'2RASH', rookies['info']['Former Members'][0]['names']['en'])
Пример #15
0
 def test_rookies(self):
     rookies_code = file(os.path.join(base, 'artist_rookies.html'),
                         'r').read()
     rookies = artist.parse_page(rookies_code)
     self.assertEqual(u"ROOKiEZ is PUNK'D", rookies['name'])
     self.assertEqual(3, len(rookies['info']['Members']))
     self.assertEqual(u'Unit', rookies['type'])
     self.assertFalse('link' in rookies['info']['Members'][0])
     self.assertEqual(u'RYOTA',
                      rookies['info']['Members'][0]['names']['en'])
     self.assertEqual(u'artist/15569',
                      rookies['info']['Members'][2]['link'])
     self.assertEqual(u'SHiNNOSUKE',
                      rookies['info']['Members'][2]['names']['en'])
     self.assertFalse('link' in rookies['info']['Former Members'][0])
     self.assertEqual(u'2RASH',
                      rookies['info']['Former Members'][0]['names']['en'])
Пример #16
0
 def test_horie(self):
     horie_code = file(os.path.join(base, "artist_horie.html"), "r").read()
     horie = artist.parse_page(horie_code)
     self.assertEqual(1, len(horie["info"]["Variations"]))
     self.assertEqual(u"白河ことり", horie["info"]["Variations"][0]["names"]["ja"])
Пример #17
0
	def test_s_s(self):
		# sexy synthesizer alias
		ss_code = file(os.path.join(base, 'artist_s_s.html'), 'r').read()
		ss = artist.parse_page(ss_code)
		self.assertEqual(u'(S_S)', ss['name'])
		self.assertEqual(u'Alias', ss['type'])
Пример #18
0
	def test_horie(self):
		horie_code = file(os.path.join(base, 'artist_horie.html'), 'r').read()
		horie = artist.parse_page(horie_code)
		self.assertEqual(1, len(horie['info']['Variations']))
		self.assertEqual(u'白河ことり', horie['info']['Variations'][0]['names']['ja'])
Пример #19
0
 def test_horie(self):
     horie_code = file(os.path.join(base, 'artist_horie.html'), 'r').read()
     horie = artist.parse_page(horie_code)
     self.assertEqual('B', horie['info']['Bloodtype'])
Пример #20
0
 def test_s_s(self):
     # sexy synthesizer alias
     ss_code = file(os.path.join(base, 'artist_s_s.html'), 'r').read()
     ss = artist.parse_page(ss_code)
     self.assertEqual(u'(S_S)', ss['name'])
     self.assertEqual(u'Alias', ss['type'])
Пример #21
0
class TestArtistsRDF(TestRDF):
    data_parser = lambda self, x: artist.parse_page(x)
    outputter_type = 'artist'

    def setUp(self):
        pass

    def run_nobuo_tests(self, graph):
        test_count_results = {
            "select ?artist where { <@base#subject> rdf:type foaf:Person . }":
            1,
            "select ?artist where { <@base#subject> rdf:type schema:Person . }":
            1,
            "select ?artist where { <@base#subject> rdf:type schema:MusicGroup . }":
            1,
            "select ?name where { ?person rdf:type foaf:Person . ?person foaf:name ?name . }":
            1,
            "select ?album where { <@base#subject> foaf:made ?album . ?album rdf:type schema:MusicAlbum }":
            1562,
            "select ?group where { ?person mo:member_of ?group . }":
            5,
            "select ?artist where { ?artist foaf:page <http://www.dogearrecords.com/> . }":
            1,
            "select ?site where { <@base#subject> foaf:page ?site . }":
            38,
            # discography
            "select ?album where { ?album dcterms:creator <@base#subject> . }":
            3122,  # includes composition and so on
            "select ?album where { ?album schema:byArtist <@base#subject> . }":
            535,
            "select ?album where { <@basealbum/79#composition> dcterms:title ?name . }":
            3,
            "select ?album where { <@basealbum/79#composition> schema:name ?name . }":
            3,
            "select ?album where { <@basealbum/108#performance> dcterms:title ?name . }":
            3,
            "select ?album where { <@basealbum/108#performance> schema:name ?name . }":
            3,
            "select ?album where { <@basealbum/79#subject> dcterms:title ?name . }":
            3,
            "select ?album where { <@basealbum/79#subject> schema:name ?name . }":
            3,
            "select ?album where { <@base#subject> foaf:made <@basealbum/79#composition> . }":
            1,
            "select ?album where { <@basealbum/79#subject> schema:byArtist <@base#subject> . }":
            1,
            "select ?album where { <@basealbum/79#subject> dcterms:creator <@base#subject> . }":
            1,
            "select ?album where { <@basealbum/79#composition> mo:composer <@base#subject> . }":
            1,
            "select ?album where { <@basealbum/79#composition> schema:creator <@base#subject> . }":
            1,
            "select ?album where { <@base#subject> mo:performed <@basealbum/1858#performance> . }":
            1,
            "select ?album where { <@basealbum/1858#performance> mo:performer <@base#subject> . }":
            1,
            "select ?album where { <@basealbum/1858#performance> schema:byArtist <@base#subject> . }":
            1,
            "select ?album where { <@base#subject> foaf:made <@basealbum/1858#lyrics> . }":
            1,
            # featured
            "select ?album where { ?album mo:tribute_to ?artist . }":
            1050,
            "select ?album where { <@base#subject> foaf:made <@basealbum/719#composition> . }":
            1
        }
        test_first_result = {
            "select ?name where { <@base#subject> foaf:name ?name . }":
            "Nobuo Uematsu",
            "select ?name where { <@base#subject> schema:name ?name . }":
            "Nobuo Uematsu",
            "select ?name where { ?person rdf:type foaf:Person . ?person foaf:name ?name . }":
            u'Nobuo Uematsu',
            "select ?birthdate where { ?birth rdf:type bio:Birth . ?birth bio:date ?birthdate . }":
            datetime.date(1959, 03, 21),
            "select ?name where { ?album rdf:type schema:MusicAlbum . <@base#subject> foaf:made ?album . ?album dcterms:title ?name . ?album schema:datePublished ?date . filter(lang(?name) = 'en')  } order by ?date":
            'CRUISE CHASER BLASSTY',
            "select ?name where { ?album rdf:type schema:MusicAlbum . ?artist foaf:made ?album . ?album dcterms:title ?name . ?album schema:datePublished ?date . filter(lang(?name) = 'en')  } order by ?date":
            'CRUISE CHASER BLASSTY',
            "select ?date where { ?album rdf:type schema:MusicAlbum . ?artist foaf:made ?album . ?album schema:datePublished ?date . } order by ?date":
            datetime.date(1986, 04, 26),
            "select ?date where { ?album rdf:type mo:Release . ?artist foaf:made ?album . ?album dcterms:created ?date . } order by ?date":
            datetime.date(1986, 04, 26),
            "select ?catalog where { ?album mo:catalogue_number ?catalog . ?album dcterms:title \"SYMPHONIC SUITE FINAL FANTASY\"@en . }":
            "H28X-10007",
            "select ?handle where { ?person foaf:account ?account . ?account foaf:accountServiceHomepage <http://www.twitter.com/> . ?account foaf:accountName ?handle . }":
            "UematsuNobuo",
            "select ?image where { <@base#subject> foaf:depiction ?image . ?image a foaf:Image }":
            "<https://media.vgm.io/artists/77/77/77-1345913713.jpg>",
            "select ?image where { <@base#subject> foaf:img ?image }":
            "<https://media.vgm.io/artists/77/77/77-1345913713.jpg>",
            "select ?image where { <@base#subject> schema:image ?image . ?image a schema:ImageObject }":
            "<https://media.vgm.io/artists/77/77/77-1345913713.jpg>",
            "select ?image where { ?image foaf:depicts <@base#subject> }":
            "<https://media.vgm.io/artists/77/77/77-1345913713.jpg>",
            "select ?image where { ?image schema:about <@base#subject> }":
            "<https://media.vgm.io/artists/77/77/77-1345913713.jpg>",
            "select ?thumb where { <@base#subject> foaf:depiction ?image . ?image foaf:thumbnail ?thumb . ?thumb a foaf:Image }":
            "<https://thumb-media.vgm.io/artists/77/77/77-1345913713.jpg>",
            "select ?thumb where { <@base#subject> schema:image ?image . ?image schema:thumbnailUrl ?thumb . ?thumb a schema:ImageObject }":
            "<https://thumb-media.vgm.io/artists/77/77/77-1345913713.jpg>"
        }

        self.run_tests(graph, test_count_results, test_first_result)

        return

    def test_nobuo_rdfa(self):
        graph = self.load_rdfa_data('artist_nobuo.html')
        self.run_nobuo_tests(graph)

    def test_nobuo_rdf(self):
        graph = self.load_rdf_data('artist_nobuo.html')
        self.run_nobuo_tests(graph)

    def run_ss_tests(self, graph):
        test_count_results = {
            "select ?artist where { <@base#subject> rdf:type foaf:Organization . }":
            1,
            "select ?artist where { <@base#subject> rdf:type schema:MusicGroup . }":
            1,
            "select ?name where { ?person schema:musicGroupMember ?member . ?member foaf:name ?name . }":
            2,
            "select ?name where { ?person schema:musicGroupMember ?member . ?member rdf:type schema:Person . }":
            2,
            "select ?name where { ?person schema:musicGroupMember ?member . ?member rdf:type foaf:Person . }":
            2
        }
        test_first_result = {
            "select ?name where { ?group schema:album ?album . ?album dcterms:title ?name . ?album schema:datePublished ?date . filter(lang(?name)='en') } order by ?date":
            u'Square Enix Music Powered Vol.1'
        }

        self.run_tests(graph, test_count_results, test_first_result)

        return

    def test_ss_rdfa(self):
        graph = self.load_rdfa_data('artist_ss.html')
        self.run_ss_tests(graph)

    def test_ss_rdf(self):
        graph = self.load_rdf_data('artist_ss.html')
        self.run_ss_tests(graph)

    def run_offenbach_tests(self, graph):
        test_count_results = {
            "select ?artist where { <@base#subject> rdf:type foaf:Person . }":
            1,
            "select ?artist where { <@base#subject> rdf:type schema:MusicGroup . }":
            1
        }
        test_first_result = {
            "select ?date where { ?birth bio:principal <@base#subject> . ?birth a bio:Birth . ?birth bio:date ?date . }":
            datetime.date(1819, 6, 20),
            "select ?date where { ?death bio:principal <@base#subject> . ?death a bio:Death . ?death bio:date ?date . }":
            datetime.date(1880, 10, 05)
        }

        self.run_tests(graph, test_count_results, test_first_result)

        return

    def test_offenbach_rdfa(self):
        graph = self.load_rdfa_data('artist_offenbach.html')
        self.run_offenbach_tests(graph)

    def test_offenbach_rdf(self):
        graph = self.load_rdf_data('artist_offenbach.html')
        self.run_offenbach_tests(graph)