def test_copy(self): from copy import deepcopy r1 = MARCReader(file('test/one.dat')).next() r2 = deepcopy(r1) r1.add_field(Field('999', [' ', ' '], subfields=['a', 'foo'])) r2.add_field(Field('999', [' ', ' '], subfields=['a', 'bar'])) self.assertEqual(r1['999']['a'], 'foo') self.assertEqual(r2['999']['a'], 'bar')
def test_copy(self): from copy import deepcopy r1 = MARCReader(file("test/one.dat")).next() r2 = deepcopy(r1) r1.add_field(Field("999", [" ", " "], subfields=["a", "foo"])) r2.add_field(Field("999", [" ", " "], subfields=["a", "bar"])) self.assertEqual(r1["999"]["a"], "foo") self.assertEqual(r2["999"]["a"], "bar")
def test_copy(self): from copy import deepcopy with open('test/one.dat', 'rb') as fh: r1 = next(MARCReader(fh)) r2 = deepcopy(r1) r1.add_field(Field('999', [' ', ' '], subfields=['a', 'foo'])) r2.add_field(Field('999', [' ', ' '], subfields=['a', 'bar'])) self.assertEqual(r1['999']['a'], 'foo') self.assertEqual(r2['999']['a'], 'bar')
def test_copy(self): from copy import deepcopy with open("test/one.dat", "rb") as fh: r1 = next(MARCReader(fh)) r2 = deepcopy(r1) r1.add_field(Field("999", [" ", " "], subfields=["a", "foo"])) r2.add_field(Field("999", [" ", " "], subfields=["a", "bar"])) self.assertEqual(r1["999"]["a"], "foo") self.assertEqual(r2["999"]["a"], "bar")
def test_multiple_isbn(self): reader = MARCReader(file("test/multi_isbn.dat")) record = reader.next() self.assertEquals(record.isbn(), "0914378287")
def test_multiple_isbn(self): with open('test/multi_isbn.dat', 'rb') as fh: reader = MARCReader(fh) record = next(reader) self.assertEqual(record.isbn(), '0914378287')
def test_multiple_isbn(self): reader = MARCReader(file('test/multi_isbn.dat')) record = reader.next() self.assertEquals(record.isbn(), '0914378287')
def read_marc(input_file, **kwargs): # type: (FilePath, **Any) -> List[PymarcRecord] return list(MARCReader(open_file(input_file)))
def test_multiple_isbn(self): reader = MARCReader(file('tests/multi_isbn.dat')) record = reader.next() self.assertEquals(record.isbn(), '0914378287')
def test_multiple_isbn(self): reader = MARCReader(io.FileIO('tests/multi_isbn.dat')) record = next(reader) self.assertEquals(record.isbn(), '0914378287')
def test_multiple_isbn(self): with open("test/multi_isbn.dat", "rb") as fh: reader = MARCReader(fh) record = next(reader) self.assertEqual(record.isbn(), "0914378287")