Exemplo n.º 1
0
 def setUp(self):
     self.matcher = BreweryNameMatcher(BREWERIES)
Exemplo n.º 2
0
class BreweryNameMatcherTest(unittest.TestCase):

    def setUp(self):
        self.matcher = BreweryNameMatcher(BREWERIES)

    def test_match_similar_name(self):
        matched = self.matcher.match_name('Aass')
        self.assertEqual(u'Aass', matched['name'])

    def test_match_name_with_different_case(self):
        matched = self.matcher.match_name('aass')
        self.assertEqual(u'Aass', matched['name'])

    def test_match_name_with_different_case2(self):
        matched = self.matcher.match_name('AASS')
        self.assertEqual(u'Aass', matched['name'])

    def test_match_name_with_corporation(self):
        matched = self.matcher.match_name('Ringnes Bryggeri')
        self.assertEqual(u'Ringnes Bryggeri (Carlsberg)', matched['name'])

    def test_match_name_with_common_stuff(self):
        matched = self.matcher.match_name('Aass Bryggeri')
        self.assertEqual(u'Aass', matched['name'])

    def test_match_name_with_common_stuff2(self):
        matched = self.matcher.match_name('Sierra Nevada Brewing Co.')
        self.assertEqual(u'Sierra Nevada Brewing Company', matched['name'])

    def test_match_name_with_case_coop_and_common(self):
        matched = self.matcher.match_name('ringnes')
        self.assertEqual(u'Ringnes Bryggeri (Carlsberg)', matched['name'])

    def test_match_difficult_name(self):
        matched = self.matcher.match_name('Abbaye des Rocs')
        self.assertEqual(u'Brasserie de l’Abbaye des Rocs', matched['name'])

    def test_match_brasserie(self):
        matched = self.matcher.match_name('Gleize')
        self.assertEqual(u'Brasserie de la Gleize', matched['name'])

    def test_match_accents(self):
        matched = self.matcher.match_name('Fantome')
        self.assertEqual(u'Brasserie Fantôme', matched['name'])

    def test_match_collab(self):
        matched = self.matcher.match_name(u'Amundsen/Grünerløkka Bryggeri')
        self.assertEqual(u'Amundsen Bryggeri & Spiseri', matched['name'])

    def test_match_misspelling(self):
        matched = self.matcher.match_name(u'Dugges Ale- & Porterbryggeri A')
        self.assertEqual(u'Dugges Ale & Porterbryggeri', matched['name'])

    def test_match_orval(self):
        matched = self.matcher.match_name(u'Brasserie d\'Orval')
        self.assertEqual(u'Brasserie dOrval', matched['name'])

    def test_match_feuillien(self):
        matched = self.matcher.match_name(u'Brasserie St. Feuillien')
        self.assertEqual(u'Brasserie St-Feuillien / Friart', matched['name'])

    def test_match_misspelling2(self):
        matched = self.matcher.match_name(u'Lervig Aktiebrygeri')
        self.assertEqual(u'Lervig Aktiebryggeri', matched['name'])

    def test_match_wild_beer(self):
        matched = self.matcher.match_name(u'The Wild Beer Co')
        self.assertEqual(u'Wild Beer', matched['name'])

    def test_match_rulles(self):
        matched = self.matcher.match_name(u'La Rulles')
        self.assertEqual(u'Brasserie Artisanale de Rulles', matched['name'])

    def test_match_coisbo(self):
        matched = self.matcher.match_name(u'Coisbo')
        self.assertEqual(u'Coisbo Beer', matched['name'])

    def test_match_moriz(self):
        matched = self.matcher.match_name(u'Moritz Beer')
        self.assertEqual(u'Cervezas Moritz', matched['name'])

    def test_match_mack(self):
        matched = self.matcher.match_name(u'Macks Ølbryggeri')
        self.assertEqual(u'Mack Bryggeri', matched['name'])

    def test_match_kirin(self):
        matched = self.matcher.match_name(u'Kirin')
        self.assertEqual(u'Kirin Brewery Company', matched['name'])

    def test_match_kievit(self):
        matched = self.matcher.match_name(u'De Kievit')
        self.assertEqual(u'Trappistenbrouwerij De Kievit', matched['name'])

    def test_match_baladin(self):
        matched = self.matcher.match_name(u'Baladin')
        self.assertEqual(u'Le Baladin', matched['name'])

    def test_match_bavik(self):
        matched = self.matcher.match_name(u'Bavik Brewery')
        self.assertEqual(u'Bavik-De Brabandere', matched['name'])

    def test_match_engelszell(self):
        matched = self.matcher.match_name(u'Stift Engelszell')
        self.assertEqual(u'Stift Engelszell Trappistenbier-Brauerei', matched['name'])

    def test_match_crak(self):
        matched = self.matcher.match_name(u'CR/AK Brewery s.r.l.')
        self.assertEqual(u'CRAK Brewery', matched['name'])

    def test_match_owa(self):
        matched = self.matcher.match_name(u'Owa Brewery')
        self.assertEqual(u'OWA Brewery SPRL', matched['name'])

    def test_match_brewfist(self):
        matched = self.matcher.match_name(u'NiuBru S.R.L. - Brewfist')
        self.assertEqual(u'Brewfist', matched['name'])

    def test_match_bitburger(self):
        matched = self.matcher.match_name(u'Bitburger Brauerei')
        self.assertEqual(u'Bitburger Brauerei Th. Simon', matched['name'])

    def test_match_colner(self):
        matched = self.matcher.match_name(u'Cölner Hofbräu')
        self.assertEqual(u'Cölner Hofbräu P. Josef Früh', matched['name'])

    def test_match_adnams(self):
        matched = self.matcher.match_name(u'Adnams Sole Bay Brewery')
        self.assertEqual(u'Adnams', matched['name'])

    def test_match_szigeti(self):
        matched = self.matcher.match_name(u'Szigeti')
        self.assertEqual(u'Sektkellerei Gebrüder Szigeti', matched['name'])

    def test_match_dugges(self):
        matched = self.matcher.match_name(u'Dugges')
        self.assertEqual(u'Dugges Ale & Porterbryggeri', matched['name'])

    def test_match_blank(self):
        matched = self.matcher.match_name(u'')
        self.assertEqual(None, matched)

    def test_match_young_co(self):
        matched = self.matcher.match_name(u'Young & Co Brewery')
        self.assertEqual(None, matched)

    def test_match_redhook(self):
        matched = self.matcher.match_name(u'Redhook Ale Brewery')
        self.assertEqual(u'Redhook Brewery', matched['name'])

    def test_match_kona(self):
        matched = self.matcher.match_name(u'Kona Brewing Co.')
        self.assertEqual(u'Kona Brewing Company', matched['name'])