示例#1
0
 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')
示例#2
0
 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')
示例#3
0
文件: record.py 项目: gsf/pymarc
    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")
示例#4
0
 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')
示例#5
0
    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")
示例#6
0
文件: record.py 项目: gsf/pymarc
 def test_multiple_isbn(self):
     reader = MARCReader(file("test/multi_isbn.dat"))
     record = reader.next()
     self.assertEquals(record.isbn(), "0914378287")
示例#7
0
 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')
示例#8
0
 def test_multiple_isbn(self):
     reader = MARCReader(file('test/multi_isbn.dat'))
     record = reader.next()
     self.assertEquals(record.isbn(), '0914378287')
示例#9
0
def read_marc(input_file, **kwargs):
    # type: (FilePath, **Any) -> List[PymarcRecord]
    return list(MARCReader(open_file(input_file)))
示例#10
0
 def test_multiple_isbn(self):
     reader = MARCReader(file('tests/multi_isbn.dat'))
     record = reader.next()
     self.assertEquals(record.isbn(), '0914378287')
示例#11
0
 def test_multiple_isbn(self):
     reader = MARCReader(io.FileIO('tests/multi_isbn.dat'))
     record = next(reader)
     self.assertEquals(record.isbn(), '0914378287')
示例#12
0
 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")