예제 #1
0
파일: product.py 프로젝트: hufman/vgmdb
	def test_ecco(self):
		# empty title dates
		ecco_code = file(os.path.join(base, 'product_ecco.html')).read()
		ecco = product.parse_page(ecco_code)
		self.assertEqual('Ecco', ecco['name'])
		self.assertEqual('Franchise', ecco['type'])
		self.assertFalse('date' in ecco['titles'][0])
예제 #2
0
 def test_ecco(self):
     # empty title dates
     ecco_code = file(os.path.join(base, 'product_ecco.html')).read()
     ecco = product.parse_page(ecco_code)
     self.assertEqual('Ecco', ecco['name'])
     self.assertEqual('Franchise', ecco['type'])
     self.assertFalse('date' in ecco['titles'][0])
예제 #3
0
파일: product.py 프로젝트: hufman/vgmdb
	def test_empty(self):
		im_code = file(os.path.join(base, 'product_empty.html'), 'r').read()
		im = product.parse_page(im_code)
		self.assertEqual(u"PROJECT IM@S", im['name'])
		self.assertEqual(u"プロジェクト・アイマス", im['name_real'])
		self.assertEqual(0, len(im['titles']))
		self.assertEqual(0, len(im['albums']))
예제 #4
0
파일: product.py 프로젝트: qood/vgmdb
 def test_empty(self):
     im_code = file(os.path.join(base, "product_empty.html"), "r").read()
     im = product.parse_page(im_code)
     self.assertEqual(u"PROJECT IM@S", im["name"])
     self.assertEqual(u"プロジェクト・アイマス", im["name_real"])
     self.assertEqual(0, len(im["titles"]))
     self.assertEqual(0, len(im["albums"]))
예제 #5
0
 def test_empty(self):
     im_code = file(os.path.join(base, 'product_empty.html'), 'r').read()
     im = product.parse_page(im_code)
     self.assertEqual(u"PROJECT IM@S", im['name'])
     self.assertEqual(u"プロジェクト・アイマス", im['name_real'])
     self.assertEqual(0, len(im['titles']))
     self.assertEqual(0, len(im['albums']))
예제 #6
0
 def test_bandai(self):
     # empty subproducts
     bandai_code = file(os.path.join(base, 'product_bandai.html')).read()
     bandai = product.parse_page(bandai_code)
     self.assertEqual('BANDAI NAMCO Games', bandai['name'])
     self.assertEqual('Meta-franchise', bandai['type'])
     self.assertEqual(0, len(bandai['subproducts']))
예제 #7
0
파일: product.py 프로젝트: hufman/vgmdb
	def test_bandai(self):
		# empty subproducts
		bandai_code = file(os.path.join(base, 'product_bandai.html')).read()
		bandai = product.parse_page(bandai_code)
		self.assertEqual('BANDAI NAMCO Games', bandai['name'])
		self.assertEqual('Meta-franchise', bandai['type'])
		self.assertEqual(0, len(bandai['subproducts']))
예제 #8
0
 def test_attack(self):
     # "other" product type
     attack_code = file(os.path.join(base, 'product_attack.html')).read()
     attack = product.parse_page(attack_code)
     self.assertEqual('Attack on Titan', attack['name'])
     self.assertEqual('Franchise', attack['type'])
     self.assertEqual('2015-08-01', attack['titles'][5]['date'])
     self.assertEqual('Other', attack['titles'][5]['type'])
예제 #9
0
파일: product.py 프로젝트: hufman/vgmdb
	def test_attack(self):
		# "other" product type
		attack_code = file(os.path.join(base, 'product_attack.html')).read()
		attack = product.parse_page(attack_code)
		self.assertEqual('Attack on Titan', attack['name'])
		self.assertEqual('Franchise', attack['type'])
		self.assertEqual('2015-08-01', attack['titles'][5]['date'])
		self.assertEqual('Other', attack['titles'][5]['type'])
예제 #10
0
파일: product.py 프로젝트: qood/vgmdb
 def test_ataraxia(self):
     at_code = file(os.path.join(base, "product_hollowataraxia.html"), "r").read()
     at = product.parse_page(at_code)
     self.assertEqual(u"Fate/hollow ataraxia", at["name"])
     self.assertEqual(27, len(at["albums"]))
     self.assertEqual(2, len(at["releases"]))
     self.assertEqual(u"2005-10-28", at["releases"][0]["date"])
     self.assertEqual(u"Fate/hollow ataraxia", at["releases"][0]["names"]["en"])
     self.assertEqual(u"Fate/hollow ataraxia", at["releases"][0]["names"]["ja"])
     self.assertEqual(u"release/2652", at["releases"][0]["link"])
예제 #11
0
	def test_witcher(self):
		witcher_code = file(os.path.join(base, 'product_witcher.html'), 'r').read()
		witcher = product.parse_page(witcher_code)
		self.assertEqual(u"2011-05-17", witcher['release_date'])
		self.assertEqual(u"The Witcher", witcher['franchises'][0]['names']['en'])
		self.assertEqual(u"The Witcher 2: Assassins of Kings", witcher['name'])
		self.assertEqual(u"Wiedźmin 2: Zabójcy królów", witcher['name_real'])
		self.assertEqual(0, len(witcher['releases']))
		self.assertEqual(u"KK25", witcher['albums'][0]['catalog'])
		self.assertEqual(u"Efendija", witcher['meta']['edited_user'])
예제 #12
0
파일: product.py 프로젝트: qood/vgmdb
 def test_clannad(self):
     cl_code = file(os.path.join(base, "product_clannad.html")).read()
     cl = product.parse_page(cl_code)
     self.assertEqual("CLANNAD", cl["name"])
     self.assertTrue("websites" in cl)
     self.assertTrue("Official" in cl["websites"])
     self.assertTrue("Reference" in cl["websites"])
     self.assertEqual(1, len(cl["websites"]["Reference"]))
     self.assertEqual(u"MobyGames", cl["websites"]["Reference"][0]["name"])
     self.assertEqual(u"http://www.mobygames.com/game/clannad", cl["websites"]["Reference"][0]["link"])
예제 #13
0
파일: product.py 프로젝트: hufman/vgmdb
	def test_clannad(self):
		cl_code = file(os.path.join(base, 'product_clannad.html')).read()
		cl = product.parse_page(cl_code)
		self.assertEqual('CLANNAD', cl['name'])
		self.assertTrue('websites' in cl)
		self.assertTrue('Official' in cl['websites'])
		self.assertTrue('Reference' in cl['websites'])
		self.assertEqual(1, len(cl['websites']['Reference']))
		self.assertEqual(u'MobyGames', cl['websites']['Reference'][0]['name'])
		self.assertEqual(u'http://www.mobygames.com/game/clannad', cl['websites']['Reference'][0]['link'])
예제 #14
0
파일: product.py 프로젝트: hufman/vgmdb
	def test_ataraxia(self):
		at_code = file(os.path.join(base, 'product_hollowataraxia.html'), 'r').read()
		at = product.parse_page(at_code)
		self.assertEqual(u"Fate/hollow ataraxia", at['name'])
		self.assertEqual(27, len(at['albums']))
		self.assertEqual(2, len(at['releases']))
		self.assertEqual(u"2005-10-28", at['releases'][0]['date'])
		self.assertEqual(u"Fate/hollow ataraxia", at['releases'][0]['names']['en'])
		self.assertEqual(u"Fate/hollow ataraxia", at['releases'][0]['names']['ja'])
		self.assertEqual(u"release/2652", at['releases'][0]['link'])
예제 #15
0
	def test_skyrim(self):
		skyrim_code = file(os.path.join(base, 'product_skyrim.html'), 'r').read()
		skyrim = product.parse_page(skyrim_code)
		self.assertEqual(u"2011-11-11", skyrim['release_date'])
		self.assertEqual(u"Bethesda Game Studios", skyrim['organizations'][0])
		self.assertEqual(u"The Elder Scrolls V: Skyrim", skyrim['name'])
		self.assertEqual(u"JPY (Japan)", skyrim['releases'][3]['region'])
		self.assertEqual(u"Gaming Fantasy", skyrim['albums'][3]['titles']['en'])
		self.assertEqual("2012-09-12T18:46", skyrim['meta']['added_date'])
		self.assertEqual("http://vgmdb.net/db/assets/logos/1387-pr-1347504448.jpg", skyrim['picture_full'])
		self.assertEqual("http://vgmdb.net/db/assets/logos-medium/1387-pr-1347504448.jpg", skyrim['picture_small'])
예제 #16
0
 def test_clannad(self):
     cl_code = file(os.path.join(base, 'product_clannad.html')).read()
     cl = product.parse_page(cl_code)
     self.assertEqual('CLANNAD', cl['name'])
     self.assertTrue('websites' in cl)
     self.assertTrue('Official' in cl['websites'])
     self.assertTrue('Reference' in cl['websites'])
     self.assertEqual(1, len(cl['websites']['Reference']))
     self.assertEqual(u'MobyGames', cl['websites']['Reference'][0]['name'])
     self.assertEqual(u'http://www.mobygames.com/game/clannad',
                      cl['websites']['Reference'][0]['link'])
예제 #17
0
파일: product.py 프로젝트: qood/vgmdb
 def test_witcher(self):
     witcher_code = file(os.path.join(base, "product_witcher.html"), "r").read()
     witcher = product.parse_page(witcher_code)
     self.assertEqual(u"2011-05-17", witcher["release_date"])
     self.assertEqual(u"The Witcher", witcher["franchises"][0]["names"]["en"])
     self.assertEqual(u"The Witcher 2: Assassins of Kings", witcher["name"])
     self.assertEqual(u"Wiedźmin 2: Zabójcy królów", witcher["name_real"])
     self.assertEqual(0, len(witcher["releases"]))
     self.assertEqual(u"KK25", witcher["albums"][0]["catalog"])
     self.assertEqual(u"Efendija", witcher["meta"]["edited_user"])
     self.assertEqual(0, len(witcher["organizations"]))
예제 #18
0
파일: product.py 프로젝트: hufman/vgmdb
	def test_hack(self):
		hack_code = file(os.path.join(base, 'product_hack.html')).read()
		hack = product.parse_page(hack_code)
		self.assertEqual('.hack//', hack['name'])
		self.assertEqual('Franchise', hack['type'])
		self.assertEqual(u".hack//SIGN", hack['titles'][0]['names']['en'])
		self.assertEqual(u"MACHIDA ~ooedo Express mail Special CD 2001~", hack['albums'][0]['titles']['en'])
		self.assertEqual(u"OEMM-0025", hack['albums'][0]['catalog'])
		self.assertEqual(u"doujin", hack['albums'][0]['type'])
		self.assertTrue(u"Fan Arrange" in hack['albums'][0]['classifications'])
		self.assertEqual('Test description', hack['description'])
예제 #19
0
파일: product.py 프로젝트: qood/vgmdb
 def test_skyrim(self):
     skyrim_code = file(os.path.join(base, "product_skyrim.html"), "r").read()
     skyrim = product.parse_page(skyrim_code)
     self.assertEqual(u"2011-11-11", skyrim["release_date"])
     self.assertEqual(u"Bethesda Game Studios", skyrim["organizations"][0]["names"]["en"])
     self.assertEqual(u"The Elder Scrolls V: Skyrim", skyrim["name"])
     self.assertEqual(u"JPY (Japan)", skyrim["releases"][3]["region"])
     self.assertFalse("link" in skyrim["releases"][3])
     self.assertEqual(u"Gaming Fantasy", skyrim["albums"][3]["titles"]["en"])
     self.assertEqual("2012-09-12T18:46", skyrim["meta"]["added_date"])
     self.assertEqual("http://vgmdb.net/db/assets/logos/1387-pr-1347504448.jpg", skyrim["picture_full"])
     self.assertEqual("http://vgmdb.net/db/assets/logos-medium/1387-pr-1347504448.jpg", skyrim["picture_small"])
예제 #20
0
 def test_hack(self):
     hack_code = file(os.path.join(base, 'product_hack.html')).read()
     hack = product.parse_page(hack_code)
     self.assertEqual('.hack//', hack['name'])
     self.assertEqual('Franchise', hack['type'])
     self.assertEqual(u".hack//SIGN", hack['titles'][0]['names']['en'])
     self.assertEqual(u"MACHIDA ~ooedo Express mail Special CD 2001~",
                      hack['albums'][0]['titles']['en'])
     self.assertEqual(u"OEMM-0025", hack['albums'][0]['catalog'])
     self.assertEqual(u"doujin", hack['albums'][0]['type'])
     self.assertTrue(u"Fan Arrange" in hack['albums'][0]['classifications'])
     self.assertEqual('Test description', hack['description'])
예제 #21
0
 def test_witcher(self):
     witcher_code = file(os.path.join(base, 'product_witcher.html'),
                         'r').read()
     witcher = product.parse_page(witcher_code)
     self.assertEqual(u"2011-05-17", witcher['release_date'])
     self.assertEqual(u"The Witcher",
                      witcher['franchises'][0]['names']['en'])
     self.assertEqual(u"The Witcher 2: Assassins of Kings", witcher['name'])
     self.assertEqual(u"Wiedźmin 2: Zabójcy królów", witcher['name_real'])
     self.assertEqual(0, len(witcher['releases']))
     self.assertEqual(u"KK25", witcher['albums'][0]['catalog'])
     self.assertEqual(u"Efendija", witcher['meta']['edited_user'])
     self.assertEqual(0, len(witcher['organizations']))
예제 #22
0
 def test_ataraxia(self):
     at_code = file(os.path.join(base, 'product_hollowataraxia.html'),
                    'r').read()
     at = product.parse_page(at_code)
     self.assertEqual(u"Fate/hollow ataraxia", at['name'])
     self.assertEqual(27, len(at['albums']))
     self.assertEqual(2, len(at['releases']))
     self.assertEqual(u"2005-10-28", at['releases'][0]['date'])
     self.assertEqual(u"Fate/hollow ataraxia",
                      at['releases'][0]['names']['en'])
     self.assertEqual(u"Fate/hollow ataraxia",
                      at['releases'][0]['names']['ja'])
     self.assertEqual(u"release/2652", at['releases'][0]['link'])
예제 #23
0
파일: product.py 프로젝트: hufman/vgmdb
	def test_madhouse(self):
		madhouse_code = file(os.path.join(base, 'product_madhouse.html')).read()
		madhouse = product.parse_page(madhouse_code)
		self.assertEqual('MADHOUSE', madhouse['name'])
		self.assertEqual('Meta-franchise', madhouse['type'])
		self.assertEqual(u"Anime Studios", madhouse['superproduct']['names']['en'])
		self.assertEqual(u"product/3854", madhouse['superproduct']['link'])
		self.assertEqual(u"Final Fantasy: Legend of the Crystals", madhouse['subproducts'][0]['names']['en'])
		self.assertEqual(u"product/177", madhouse['subproducts'][0]['link'])
		self.assertEqual(u"Animation", madhouse['subproducts'][0]['type'])
		self.assertEqual(u"1994-02-21", madhouse['subproducts'][0]['date'])
		self.assertEqual(u"Final Fantasy \"The Wind Chapter\" \"The Fire Chapter\" Soundtrack", madhouse['albums'][0]['titles']['en'])
		self.assertEqual(u"COCC-11741", madhouse['albums'][0]['catalog'])
		self.assertEqual(u"anime", madhouse['albums'][0]['type'])
예제 #24
0
파일: product.py 프로젝트: qood/vgmdb
 def test_at(self):
     at_code = file(os.path.join(base, "product_at.html"), "r").read()
     at = product.parse_page(at_code)
     self.assertEqual(u"Ar tonelico", at["name"])
     self.assertEqual(u"アルトネリコ", at["name_real"])
     self.assertEqual(4, len(at["titles"]))
     self.assertEqual(u"Ar tonelico: Melody of Elemia", at["titles"][0]["names"]["en"])
     self.assertEqual(u"product/566", at["titles"][0]["link"])
     self.assertEqual(u"2010-12-26T03:20", at["meta"]["added_date"])
     self.assertTrue(not at.has_key("picture_full"))
     two = [at["albums"][32], at["albums"][33]]
     for thing in two:  # two albums released on the same date, hard to sort
         if thing["link"] == "album/20283":
             self.assertEqual(True, thing["reprint"])
예제 #25
0
	def test_at(self):
		at_code = file(os.path.join(base, 'product_at.html'), 'r').read()
		at = product.parse_page(at_code)
		self.assertEqual(u"Ar tonelico", at['name'])
		self.assertEqual(u"アルトネリコ", at['name_real'])
		self.assertEqual(4, len(at['titles']))
		self.assertEqual(u"Ar tonelico: Melody of Elemia", at['titles'][0]['names']['en'])
		self.assertEqual(u"product/566", at['titles'][0]['link'])
		self.assertEqual(u"2010-12-26T03:20", at['meta']['added_date'])
		self.assertTrue(not at.has_key('picture_full'))
		two = [at['albums'][32], at['albums'][33]]
		for thing in two:	# two albums released on the same date, hard to sort
			if thing['link'] == 'album/20283':
				self.assertEqual(True, thing['reprint'])
예제 #26
0
 def test_at(self):
     at_code = file(os.path.join(base, 'product_at.html'), 'r').read()
     at = product.parse_page(at_code)
     self.assertEqual('Franchise', at['type'])
     self.assertEqual(u"Ar tonelico", at['name'])
     self.assertEqual(u"アルトネリコ", at['name_real'])
     self.assertEqual(4, len(at['titles']))
     self.assertEqual(u"Ar tonelico: Melody of Elemia",
                      at['titles'][0]['names']['en'])
     self.assertEqual(u"product/566", at['titles'][0]['link'])
     self.assertEqual(u"Game", at['titles'][0]['type'])
     self.assertEqual(u"2010-12-26T03:20", at['meta']['added_date'])
     self.assertTrue(not at.has_key('picture_full'))
     two = [at['albums'][32], at['albums'][33]]
     for thing in two:  # two albums released on the same date, hard to sort
         if thing['link'] == 'album/20283':
             self.assertEqual(True, thing['reprint'])
예제 #27
0
 def test_madhouse(self):
     madhouse_code = file(os.path.join(base,
                                       'product_madhouse.html')).read()
     madhouse = product.parse_page(madhouse_code)
     self.assertEqual('MADHOUSE', madhouse['name'])
     self.assertEqual('Meta-franchise', madhouse['type'])
     self.assertEqual(u"Anime Studios",
                      madhouse['superproduct']['names']['en'])
     self.assertEqual(u"product/3854", madhouse['superproduct']['link'])
     self.assertEqual(u"Final Fantasy: Legend of the Crystals",
                      madhouse['subproducts'][0]['names']['en'])
     self.assertEqual(u"product/177", madhouse['subproducts'][0]['link'])
     self.assertEqual(u"Animation", madhouse['subproducts'][0]['type'])
     self.assertEqual(u"1994-02-21", madhouse['subproducts'][0]['date'])
     self.assertEqual(
         u"Final Fantasy \"The Wind Chapter\" \"The Fire Chapter\" Soundtrack",
         madhouse['albums'][0]['titles']['en'])
     self.assertEqual(u"COCC-11741", madhouse['albums'][0]['catalog'])
     self.assertEqual(u"anime", madhouse['albums'][0]['type'])
예제 #28
0
 def test_skyrim(self):
     skyrim_code = file(os.path.join(base, 'product_skyrim.html'),
                        'r').read()
     skyrim = product.parse_page(skyrim_code)
     self.assertEqual(u"2011-11-11", skyrim['release_date'])
     self.assertEqual(u"Bethesda Game Studios, Bethesda Softworks",
                      skyrim['organizations'][0]['names']['en'])
     self.assertEqual(u"The Elder Scrolls V: Skyrim", skyrim['name'])
     self.assertEqual(u"Japan", skyrim['releases'][3]['region'])
     self.assertEqual('release/2121', skyrim['releases'][3]['link'])
     self.assertEqual(u"Gaming Fantasy",
                      skyrim['albums'][4]['titles']['en'])
     self.assertEqual("2012-09-12T18:46", skyrim['meta']['added_date'])
     self.assertEqual(
         "https://media.vgm.io/products/78/1387/1387-1347504448.jpg",
         skyrim['picture_full'])
     self.assertEqual(
         "https://thumb-media.vgm.io/products/78/1387/1387-1347504448.jpg",
         skyrim['picture_small'])
예제 #29
0
class TestProductRDF(TestRDF):
    data_parser = lambda self, x: product.parse_page(x)
    outputter_type = 'product'

    def setUp(self):
        pass

    def run_skyrim_tests(self, graph):
        test_count_results = {
            "select ?type where { <@base#subject> rdf:type schema:CreativeWork . }":
            1
        }
        test_first_result = {
            "select ?name where { <@base#subject> dcterms:title ?name . }":
            "The Elder Scrolls V: Skyrim",
            "select ?name where { <@base#subject> schema:name ?name . }":
            "The Elder Scrolls V: Skyrim",
            "select ?catalog where { ?album mo:catalogue_number \"JOY-552\" . ?album mo:catalogue_number ?catalog . } ":
            "JOY-552",
            "select ?name where { ?album mo:catalogue_number \"JOY-552\" . ?album dcterms:title ?name . filter(lang(?name)='en') } ":
            "A Bard's Side Quest",
            "select ?date where { ?album mo:catalogue_number \"JOY-552\" . ?album dcterms:created ?date . } ":
            datetime.date(2013, 01, 18),
            "select ?about where { ?album mo:catalogue_number \"JOY-552\" . ?album schema:about ?about . } ":
            "<@base#subject>",
            "select ?image where { <@base#subject> foaf:depiction ?image . ?image a foaf:Image } ":
            "<https://media.vgm.io/products/78/1387/1387-1347504448.jpg>",
            "select ?image where { <@base#subject> schema:image ?image . ?image a schema:ImageObject } ":
            "<https://media.vgm.io/products/78/1387/1387-1347504448.jpg>",
            "select ?image where { ?image foaf:depicts <@base#subject> . } ":
            "<https://media.vgm.io/products/78/1387/1387-1347504448.jpg>",
            "select ?image where { ?image schema:about <@base#subject> . ?image a schema:ImageObject } ":
            "<https://media.vgm.io/products/78/1387/1387-1347504448.jpg>",
            "select ?thumb where { <@base#subject> foaf:depiction ?image . ?image foaf:thumbnail ?thumb . ?thumb a foaf:Image } ":
            "<https://thumb-media.vgm.io/products/78/1387/1387-1347504448.jpg>",
            "select ?thumb where { <@base#subject> schema:image ?image . ?image schema:thumbnailUrl ?thumb . ?thumb a schema:ImageObject } ":
            "<https://thumb-media.vgm.io/products/78/1387/1387-1347504448.jpg>"
        }

        self.run_tests(graph, test_count_results, test_first_result)

        return

    def test_skyrim_rdfa(self):
        graph = self.load_rdfa_data('product_skyrim.html')
        self.run_skyrim_tests(graph)

    def test_skyrim_rdf(self):
        graph = self.load_rdf_data('product_skyrim.html')
        self.run_skyrim_tests(graph)

    def run_witcher_tests(self, graph):
        test_count_results = {
            "select ?type where { <@base#subject> rdf:type schema:CreativeWork . }":
            1,
            "select ?thing where { ?thing rdf:type schema:CreativeWork . }":
            2,
            "select ?name where { ?product schema:name \"The Witcher\"@en . }":
            1,
            "select ?name where { ?product schema:name \"Wiedźmin\"@ja . }":
            1,
            "select ?album where { ?album schema:about <@base#subject> . ?album a schema:MusicAlbum }":
            8
        }
        test_first_result = {
            "select ?name where { <@base#subject> dcterms:title ?name . }":
            "The Witcher 2: Assassins of Kings",
            "select ?name where { <@base#subject> schema:name ?name . }":
            "The Witcher 2: Assassins of Kings"
        }

        self.run_tests(graph, test_count_results, test_first_result)

        return

    def test_witcher_rdfa(self):
        graph = self.load_rdfa_data('product_witcher.html')
        self.run_witcher_tests(graph)

    def test_witcher_rdf(self):
        graph = self.load_rdf_data('product_witcher.html')
        self.run_witcher_tests(graph)