Example #1
0
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 )
Example #2
0
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)
Example #3
0
 def setUp( self ):
     """ Runs initialization. """
     self.maker = TitleMaker()
Example #4
0
 def setUp(self):
     """ Runs initialization. """
     self.maker = TitleMaker()