Ejemplo n.º 1
0
 def test_remove_fields(self):
     with open('test/testunimarc.dat', 'rb') as fh:
         record = Record(fh.read(), force_utf8=True)
     self.assertTrue(len(record.get_fields('899'))!=0)
     self.assertTrue(len(record.get_fields('702'))!=0)
     record.remove_fields('899', '702')
     self.assertTrue(len(record.get_fields('899'))==0)
     self.assertTrue(len(record.get_fields('702'))==0)
Ejemplo n.º 2
0
 def test_remove_fields(self):
     with open("test/testunimarc.dat", "rb") as fh:
         record = Record(fh.read(), force_utf8=True)
     self.assertTrue(len(record.get_fields("899")) != 0)
     self.assertTrue(len(record.get_fields("702")) != 0)
     record.remove_fields("899", "702")
     self.assertTrue(len(record.get_fields("899")) == 0)
     self.assertTrue(len(record.get_fields("702")) == 0)
Ejemplo n.º 3
0
 def test_remove_fields(self):
     with open('test/testunimarc.dat', 'rb') as fh:
         record = Record(fh.read(), force_utf8=True)
     self.assertTrue(len(record.get_fields('899'))!=0)
     self.assertTrue(len(record.get_fields('702'))!=0)
     record.remove_fields('899', '702')
     self.assertTrue(len(record.get_fields('899'))==0)
     self.assertTrue(len(record.get_fields('702'))==0)
Ejemplo n.º 4
0
 def test_remove_fields(self):
     with open("test/testunimarc.dat", "rb") as fh:
         record = Record(fh.read(), force_utf8=True)
     self.assertTrue(len(record.get_fields("899")) != 0)
     self.assertTrue(len(record.get_fields("702")) != 0)
     record.remove_fields("899", "702")
     self.assertTrue(len(record.get_fields("899")) == 0)
     self.assertTrue(len(record.get_fields("702")) == 0)
Ejemplo n.º 5
0
Archivo: record.py Proyecto: gsf/pymarc
 def test_find(self):
     record = Record()
     subject1 = Field(tag="650", indicators=["", "0"], subfields=["a", "Programming Language"])
     record.add_field(subject1)
     subject2 = Field(tag="650", indicators=["", "0"], subfields=["a", "Object Oriented"])
     record.add_field(subject2)
     found = record.get_fields("650")
     self.assertEqual(found[0], subject1, "get_fields() item 1")
     self.assertEqual(found[0], subject1, "get_fields() item 2")
     found = record.get_fields()
     self.assertEqual(len(found), 2, "get_fields() with no tag")
Ejemplo n.º 6
0
 def test_find(self):
     record = Record()
     subject1 = Field(tag='650',
                      indicators=['', '0'],
                      subfields=['a', 'Programming Language'])
     record.add_field(subject1)
     subject2 = Field(tag='650',
                      indicators=['', '0'],
                      subfields=['a', 'Object Oriented'])
     record.add_field(subject2)
     found = record.get_fields('650')
     self.assertEqual(found[0], subject1, 'get_fields() item 1')
     self.assertEqual(found[0], subject1, 'get_fields() item 2')
     found = record.get_fields()
     self.assertEqual(len(found), 2, 'get_fields() with no tag')
Ejemplo n.º 7
0
 def test_find(self):
     record = Record()
     subject1 = Field(tag="650",
                      indicators=["", "0"],
                      subfields=["a", "Programming Language"])
     record.add_field(subject1)
     subject2 = Field(tag="650",
                      indicators=["", "0"],
                      subfields=["a", "Object Oriented"])
     record.add_field(subject2)
     found = record.get_fields("650")
     self.assertEqual(found[0], subject1, "get_fields() item 1")
     self.assertEqual(found[0], subject1, "get_fields() item 2")
     found = record.get_fields()
     self.assertEqual(len(found), 2, "get_fields() with no tag")
Ejemplo n.º 8
0
Archivo: record.py Proyecto: gsf/pymarc
 def test_multi_find(self):
     record = Record()
     subject1 = Field(tag="650", indicators=["", "0"], subfields=["a", "Programming Language"])
     record.add_field(subject1)
     subject2 = Field(tag="651", indicators=["", "0"], subfields=["a", "Object Oriented"])
     record.add_field(subject2)
     found = record.get_fields("650", "651")
     self.assertEquals(len(found), 2)
Ejemplo n.º 9
0
 def test_find(self):
     record = Record() 
     subject1 = Field(
         tag = '650', 
         indicators = ['', '0'], 
         subfields = ['a', 'Programming Language'])
     record.add_field(subject1)
     subject2 = Field(
         tag = '650', 
         indicators = ['', '0'], 
         subfields = ['a', 'Object Oriented'])
     record.add_field(subject2)
     found = record.get_fields('650')
     self.assertEqual(found[0], subject1, 'get_fields() item 1')
     self.assertEqual(found[0], subject1, 'get_fields() item 2')
     found = record.get_fields()
     self.assertEqual(len(found), 2, 'get_fields() with no tag')
Ejemplo n.º 10
0
Archivo: record.py Proyecto: gsf/pymarc
 def test_alphatag(self):
     record = Record()
     record.add_field(Field("CAT", [" ", " "], subfields=["a", "foo"]))
     record.add_field(Field("CAT", [" ", " "], subfields=["b", "bar"]))
     fields = record.get_fields("CAT")
     self.assertEqual(len(fields), 2)
     self.assertEqual(fields[0]["a"], "foo")
     self.assertEqual(fields[1]["b"], "bar")
     self.assertEqual(record["CAT"]["a"], "foo")
Ejemplo n.º 11
0
 def test_alphatag(self):
     record = Record()
     record.add_field(Field('CAT', [' ', ' '], subfields=['a', 'foo']))
     record.add_field(Field('CAT', [' ', ' '], subfields=['b', 'bar']))
     fields = record.get_fields('CAT')
     self.assertEqual(len(fields), 2)
     self.assertEqual(fields[0]['a'], 'foo')
     self.assertEqual(fields[1]['b'], 'bar')
     self.assertEqual(record['CAT']['a'], 'foo')
Ejemplo n.º 12
0
 def test_alphatag(self):
     record = Record()
     record.add_field(Field('CAT', [' ', ' '], subfields=['a', 'foo']))
     record.add_field(Field('CAT', [' ', ' '], subfields=['b', 'bar']))
     fields = record.get_fields('CAT')
     self.assertEqual(len(fields), 2)
     self.assertEqual(fields[0]['a'], 'foo')
     self.assertEqual(fields[1]['b'], 'bar')
     self.assertEqual(record['CAT']['a'], 'foo')
Ejemplo n.º 13
0
 def test_alphatag(self):
     record = Record()
     record.add_field(Field("CAT", [" ", " "], subfields=["a", "foo"]))
     record.add_field(Field("CAT", [" ", " "], subfields=["b", "bar"]))
     fields = record.get_fields("CAT")
     self.assertEqual(len(fields), 2)
     self.assertEqual(fields[0]["a"], "foo")
     self.assertEqual(fields[1]["b"], "bar")
     self.assertEqual(record["CAT"]["a"], "foo")
Ejemplo n.º 14
0
 def test_multi_find(self):
     record = Record()
     subject1 = Field(tag='650',
                      indicators=['', '0'],
                      subfields=['a', 'Programming Language'])
     record.add_field(subject1)
     subject2 = Field(tag='651',
                      indicators=['', '0'],
                      subfields=['a', 'Object Oriented'])
     record.add_field(subject2)
     found = record.get_fields('650', '651')
     self.assertEqual(len(found), 2)
Ejemplo n.º 15
0
 def test_multi_find(self):
     record = Record()
     subject1 = Field(tag="650",
                      indicators=["", "0"],
                      subfields=["a", "Programming Language"])
     record.add_field(subject1)
     subject2 = Field(tag="651",
                      indicators=["", "0"],
                      subfields=["a", "Object Oriented"])
     record.add_field(subject2)
     found = record.get_fields("650", "651")
     self.assertEqual(len(found), 2)
Ejemplo n.º 16
0
 def test_multi_find(self):
     record = Record() 
     subject1 = Field(
         tag = '650', 
         indicators = ['', '0'], 
         subfields = ['a', 'Programming Language'])
     record.add_field(subject1)
     subject2 = Field(
         tag = '651', 
         indicators = ['', '0'], 
         subfields = ['a', 'Object Oriented'])
     record.add_field(subject2)
     found = record.get_fields('650', '651')
     self.assertEqual(len(found), 2)