예제 #1
0
 def test_template_attr_None_keeps_vendor_subfields(self):
     vfield = Field(
         tag="961",
         indicators=[" ", " "],
         subfields=[
             "a",
             "1",
             "c",
             "2",
             "d",
             "3",
             "e",
             "4",
             "f",
             "5",
             "g",
             "6",
             "i",
             "7",
             "j",
             "8",
             "k",
             "9",
             "l",
             "10",
             "m",
             "11",
             "h",
             "12",
         ],
     )
     field = bibs.db_template_to_961(self.temp, vfield)
     self.assertEqual(str(field),
                      "=961  \\\\$a1$c2$d3$e4$f5$g6$h12$m11$i7$j8$k9$l10")
예제 #2
0
 def test_returns_Field_obj_when_template_None_but_field_exists(self):
     vfield = Field(tag="961",
                    indicators=[" ", " "],
                    subfields=["a", "1", "b", "2"])
     field = bibs.db_template_to_961(self.temp, vfield)
     self.assertIsInstance(field, Field)
     self.assertEqual(str(field), "=961  \\\\$b2$a1")
예제 #3
0
    def test_mixed_vendor_template_field(self):
        vfield = Field(
            tag="961",
            indicators=[" ", " "],
            subfields=[
                "a",
                "1",
                "v",
                "1",
            ],
        )

        self.temp.identity = "a"
        self.temp.blanketPO = "m"
        field = bibs.db_template_to_961(self.temp, vfield)
        self.assertEqual(str(field), "=961  \\\\$v1$aa$mm")
예제 #4
0
    def test_if_template_overwrites_vendor_subfields(self):
        self.temp.identity = "a"
        self.temp.generalNote = "c"
        self.temp.internalNote = "d"
        self.temp.oldOrdNo = "e"
        self.temp.selector = "f"
        self.temp.venAddr = "g"
        self.temp.venNote = "h"
        self.temp.blanketPO = "m"
        self.temp.venTitleNo = "i"
        self.temp.paidNote = "j"
        self.temp.shipTo = "k"
        self.temp.requestor = "l"

        vfield = Field(
            tag="961",
            indicators=[" ", " "],
            subfields=[
                "a",
                "1",
                "c",
                "3",
                "d",
                "4",
                "e",
                "5",
                "f",
                "6",
                "g",
                "7",
                "i",
                "8",
                "j",
                "9",
                "k",
                "10",
                "l",
                "11",
                "m",
                "12",
                "h",
                "13",
            ],
        )
        field = bibs.db_template_to_961(self.temp, vfield)
        self.assertEqual(str(field),
                         "=961  \\\\$aa$cc$dd$ee$ff$gg$hh$mm$ii$jj$kk$ll")
예제 #5
0
 def test_1(self):
     vfield = Field(tag="961", indicators=[" ", " "], subfields=["h", "g"])
     field = bibs.db_template_to_961(self.temp, vfield)
     self.assertEqual(str(field), "=961  \\\\$hg")
예제 #6
0
 def test_retuns_None_if_all_template_attr_not_None(self):
     field = bibs.db_template_to_961(self.temp, None)
     self.assertIsNone(field)
예제 #7
0
 def test_no_vendor961_but_at_least_one_template_attr_set(self):
     self.temp.internalNote = "TEST"
     field = bibs.db_template_to_961(self.temp, None)
     self.assertEqual(str(field), "=961  \\\\$dTEST")
     self.temp.internalNote = None
예제 #8
0
 def test_vendor_subfields_None_return_None(self):
     field = bibs.db_template_to_961(self.temp, None)
     self.assertIsNone(field)