class TitleMakerTest( TestCase ): """ Tests unicode-title maker. """ def setUp( self ): """ Runs initialization. """ self.maker = TitleMaker() def test__build_title__unicode_with_solr_match( self ): """ Checks api lookup. """ issn = '0259-3750' initial_title = 'Dong Wu fa l� xue bao = Soochow law review' self.assertEqual( 'Dong Wu fa lü xue bao = Soochow law review', self.maker.build_title(issn, initial_title) ) def test__build_title__plain_ascii( self ): """ Doesn't need to be looked up. """ issn = '0146-4787' initial_title = 'SIAM journal on control and optimization' self.assertEqual( 'SIAM journal on control and optimization', self.maker.build_title(issn, initial_title) ) def test__build_title__unicode_without_solr_match_match( self ): """ Doesn't need to be looked up. """ issn = '1234-5678' initial_title = 'f�oo' self.assertEqual( {}, self.maker.non_matches ) self.assertEqual( 'f�oo', self.maker.build_title(issn, initial_title) ) self.assertEqual( {u'1234-5678': u'f\ufffdoo'}, self.maker.non_matches )
class TitleMakerTest(TestCase): """ Tests unicode-title maker. """ def setUp(self): """ Runs initialization. """ self.maker = TitleMaker() def test__build_title__unicode_with_solr_match(self): """ Checks api lookup. """ issn = '0259-3750' initial_title = 'Dong Wu fa l� xue bao = Soochow law review' self.assertEqual('Dong Wu fa lü xue bao = Soochow law review', self.maker.build_title(issn, initial_title)) def test__build_title__plain_ascii(self): """ Doesn't need to be looked up. """ issn = '0146-4787' initial_title = 'SIAM journal on control and optimization' self.assertEqual('SIAM journal on control and optimization', self.maker.build_title(issn, initial_title)) def test__build_title__unicode_without_solr_match_match(self): """ Doesn't need to be looked up. """ issn = '1234-5678' initial_title = 'f�oo' self.assertEqual({}, self.maker.non_matches) self.assertEqual('f�oo', self.maker.build_title(issn, initial_title)) self.assertEqual({u'1234-5678': u'f\ufffdoo'}, self.maker.non_matches)
def setUp( self ): """ Runs initialization. """ self.maker = TitleMaker()
def setUp(self): """ Runs initialization. """ self.maker = TitleMaker()