Beispiel #1
0
    def test_template_overwrites_vendor(self):
        self.temp.acqType = "a"
        self.temp.claim = "b"
        self.temp.code1 = "c"
        self.temp.code2 = "d"
        self.temp.code3 = "e"
        self.temp.code4 = "f"
        self.temp.form = "g"
        self.temp.orderNote = "h"
        self.temp.orderType = "i"
        self.temp.status = "m"
        self.temp.vendor = "v"
        self.temp.lang = "w"
        self.temp.country = "x"

        vfield = Field(
            tag="960",
            indicators=[" ", " "],
            subfields=[
                "a",
                "1",
                "b",
                "2",
                "c",
                "3",
                "d",
                "4",
                "e",
                "5",
                "f",
                "6",
                "g",
                "7",
                "h",
                "8",
                "i",
                "9",
                "m",
                "10",
                "v",
                "11",
                "w",
                "12",
                "x",
                "13",
            ],
        )

        field = bibs.db_template_to_960(self.temp, vfield)
        self.assertEqual(str(field),
                         "=960  \\\\$aa$bb$cc$dd$ee$ff$gg$hh$ii$mm$vv$ww$xx")
Beispiel #2
0
    def test_mixed_template_vendor_subfields(self):
        self.temp.acqType = "a"
        self.temp.code2 = "d"
        self.temp.code3 = "e"
        self.temp.orderType = "i"
        self.temp.status = "m"
        self.temp.vendor = "v"

        vfield = Field(
            tag="960",
            indicators=[" ", " "],
            subfields=["a", "1", "s", "9.99", "u", "2"],
        )
        field = bibs.db_template_to_960(self.temp, vfield)
        self.assertEqual(str(field), "=960  \\\\$s9.99$u2$aa$dd$ee$ii$mm$vv")
Beispiel #3
0
    def test_template_None_keeps_vendor_subfields(self):
        vfield = Field(
            tag="960",
            indicators=[" ", " "],
            subfields=[
                "a",
                "1",
                "b",
                "2",
                "c",
                "3",
                "d",
                "4",
                "e",
                "5",
                "f",
                "6",
                "g",
                "7",
                "h",
                "8",
                "i",
                "9",
                "m",
                "10",
                "v",
                "11",
                "w",
                "12",
                "x",
                "13",
            ],
        )

        field = bibs.db_template_to_960(self.temp, vfield)
        self.assertEqual(
            str(field), "=960  \\\\$a1$b2$c3$d4$e5$f6$g7$h8$i9$m1$v11$w12$x13")
Beispiel #4
0
 def test_no_vendor960_but_at_least_one_template_attr_set(self):
     self.temp.vendor = "TEST"
     field = bibs.db_template_to_960(self.temp, None)
     self.assertEqual(str(field), "=960  \\\\$m1$vTEST")
     self.temp.internalNote = None
     self.temp.vendor = None
Beispiel #5
0
 def test_vendor_960_is_None(self):
     field = bibs.db_template_to_960(self.temp, None)
     self.assertIsInstance(field, Field)
     self.assertEqual(field["m"], "1")
     self.assertEqual(str(field), "=960  \\\\$m1")