def setUp(self): """ Runs initialization. """ self.defs_dct = { # proper row field-definitions 'library': 0, 'branch': 1, 'location': 2, 'callnumber': 3, 'title': 4, 'format': 5, 'issn_num': 6, 'issn_type': 7, 'vol_start': 8, 'vol_end': 9, 'year': 10 } self.fixer = RowFixer(self.defs_dct)
class RowFixerTest( TestCase ): """ Tests models.RowFixer """ def setUp( self ): """ Runs initialization. """ self.defs_dct = { # proper row field-definitions 'library': 0 , 'branch': 1, 'location': 2, 'callnumber': 3, 'title': 4, 'format': 5, 'issn_num': 6, 'issn_type': 7, 'vol_start': 8, 'vol_end': 9, 'year': 10 } self.fixer = RowFixer( self.defs_dct ) def test__fix_row( self ): """ Tests filtering and parsing of records for easyAccess db. """ bad_string = 'RBN,Main Library,qs,QP1 .E7,Ergebnisse der Physiologie, biologischen Chemie und experimentellen Pharmakologie. Reviews of physiology, biochemistry, and experimental pharmacology,Print,0080-2042,ISSN,1,69,1937' bad_row = bad_string.split( ',' ) self.assertEqual( [u'RBN', u'Main Library', u'qs', u'QP1 .E7', u'Ergebnisse der Physiologie biologischen Chemie und experimentellen Pharmakologie. Reviews of physiology, biochemistry, and experimental pharmacology', u'Print', u'0080-2042', u'ISSN', u'1', u'69', u'1937'], self.fixer.fix_row( bad_row ) )
class RowFixerTest(TestCase): """ Tests models.RowFixer """ def setUp(self): """ Runs initialization. """ self.defs_dct = { # proper row field-definitions 'library': 0, 'branch': 1, 'location': 2, 'callnumber': 3, 'title': 4, 'format': 5, 'issn_num': 6, 'issn_type': 7, 'vol_start': 8, 'vol_end': 9, 'year': 10 } self.fixer = RowFixer(self.defs_dct) def test__fix_row(self): """ Tests filtering and parsing of records for easyAccess db. """ bad_string = 'RBN,Main Library,qs,QP1 .E7,Ergebnisse der Physiologie, biologischen Chemie und experimentellen Pharmakologie. Reviews of physiology, biochemistry, and experimental pharmacology,Print,0080-2042,ISSN,1,69,1937' bad_row = bad_string.split(',') self.assertEqual([ u'RBN', u'Main Library', u'qs', u'QP1 .E7', u'Ergebnisse der Physiologie biologischen Chemie und experimentellen Pharmakologie. Reviews of physiology, biochemistry, and experimental pharmacology', u'Print', u'0080-2042', u'ISSN', u'1', u'69', u'1937' ], self.fixer.fix_row(bad_row))
def setUp( self ): """ Runs initialization. """ self.defs_dct = { # proper row field-definitions 'library': 0 , 'branch': 1, 'location': 2, 'callnumber': 3, 'title': 4, 'format': 5, 'issn_num': 6, 'issn_type': 7, 'vol_start': 8, 'vol_end': 9, 'year': 10 } self.fixer = RowFixer( self.defs_dct )