예제 #1
0
    def test_nsattrs_wattr(self):
        attrs = AttributesNSImpl({(ns_uri, "attr"): "val"}, {(ns_uri, "attr"): "ns:attr"})

        self.assertEqual(attrs.getLength(), 1)
        self.assertEqual(attrs.getNames(), [(ns_uri, "attr")])
        self.assertEqual(attrs.getQNames(), ["ns:attr"])
        self.assertEqual(len(attrs), 1)
        self.assertIn((ns_uri, "attr"), attrs)
        self.assertEqual(list(attrs.keys()), [(ns_uri, "attr")])
        self.assertEqual(attrs.get((ns_uri, "attr")), "val")
        self.assertEqual(attrs.get((ns_uri, "attr"), 25), "val")
        self.assertEqual(list(attrs.items()), [((ns_uri, "attr"), "val")])
        self.assertEqual(list(attrs.values()), ["val"])
        self.assertEqual(attrs.getValue((ns_uri, "attr")), "val")
        self.assertEqual(attrs.getValueByQName("ns:attr"), "val")
        self.assertEqual(attrs.getNameByQName("ns:attr"), (ns_uri, "attr"))
        self.assertEqual(attrs[(ns_uri, "attr")], "val")
        self.assertEqual(attrs.getQNameByName((ns_uri, "attr")), "ns:attr")
예제 #2
0
 def test_nsattrs_wattr(self):
     attrs = AttributesNSImpl({(ns_uri, 'attr'): 'val'},
                              {(ns_uri, 'attr'): 'ns:attr'})
     self.assertEqual(attrs.getLength(), 1)
     self.assertEqual(attrs.getNames(), [(ns_uri, 'attr')])
     self.assertEqual(attrs.getQNames(), ['ns:attr'])
     self.assertEqual(len(attrs), 1)
     self.assertIn((ns_uri, 'attr'), attrs)
     self.assertEqual(list(attrs.keys()), [(ns_uri, 'attr')])
     self.assertEqual(attrs.get((ns_uri, 'attr')), 'val')
     self.assertEqual(attrs.get((ns_uri, 'attr'), 25), 'val')
     self.assertEqual(list(attrs.items()), [((ns_uri, 'attr'), 'val')])
     self.assertEqual(list(attrs.values()), ['val'])
     self.assertEqual(attrs.getValue((ns_uri, 'attr')), 'val')
     self.assertEqual(attrs.getValueByQName('ns:attr'), 'val')
     self.assertEqual(attrs.getNameByQName('ns:attr'), (ns_uri, 'attr'))
     self.assertEqual(attrs[ns_uri, 'attr'], 'val')
     self.assertEqual(attrs.getQNameByName((ns_uri, 'attr')), 'ns:attr')
예제 #3
0
def test_nsattrs_wattr():
    attrs = AttributesNSImpl({(ns_uri, "attr"): "val"},
                             {(ns_uri, "attr"): "ns:attr"})

    return attrs.getLength() == 1 and \
           attrs.getNames() == [(ns_uri, "attr")] and \
           attrs.getQNames() == ["ns:attr"] and \
           len(attrs) == 1 and \
           attrs.has_key((ns_uri, "attr")) and \
           attrs.keys() == [(ns_uri, "attr")] and \
           attrs.get((ns_uri, "attr")) == "val" and \
           attrs.get((ns_uri, "attr"), 25) == "val" and \
           attrs.items() == [((ns_uri, "attr"), "val")] and \
           attrs.values() == ["val"] and \
           attrs.getValue((ns_uri, "attr")) == "val" and \
           attrs.getValueByQName("ns:attr") == "val" and \
           attrs.getNameByQName("ns:attr") == (ns_uri, "attr") and \
           attrs[(ns_uri, "attr")] == "val" and \
           attrs.getQNameByName((ns_uri, "attr")) == "ns:attr"
예제 #4
0
    def test_nsattrs_wattr(self):
        attrs = AttributesNSImpl({(ns_uri, "attr"): "val"},
                                 {(ns_uri, "attr"): "ns:attr"})

        self.assertEqual(attrs.getLength(), 1)
        self.assertEqual(attrs.getNames(), [(ns_uri, "attr")])
        self.assertEqual(attrs.getQNames(), ["ns:attr"])
        self.assertEqual(len(attrs), 1)
        self.assertIn((ns_uri, "attr"), attrs)
        self.assertEqual(list(attrs.keys()), [(ns_uri, "attr")])
        self.assertEqual(attrs.get((ns_uri, "attr")), "val")
        self.assertEqual(attrs.get((ns_uri, "attr"), 25), "val")
        self.assertEqual(list(attrs.items()), [((ns_uri, "attr"), "val")])
        self.assertEqual(list(attrs.values()), ["val"])
        self.assertEqual(attrs.getValue((ns_uri, "attr")), "val")
        self.assertEqual(attrs.getValueByQName("ns:attr"), "val")
        self.assertEqual(attrs.getNameByQName("ns:attr"), (ns_uri, "attr"))
        self.assertEqual(attrs[(ns_uri, "attr")], "val")
        self.assertEqual(attrs.getQNameByName((ns_uri, "attr")), "ns:attr")
예제 #5
0
def test_nsattrs_wattr():
    attrs = AttributesNSImpl({(ns_uri, "attr") : "val"},
                             {(ns_uri, "attr") : "ns:attr"})

    return attrs.getLength() == 1 and \
           attrs.getNames() == [(ns_uri, "attr")] and \
           attrs.getQNames() == ["ns:attr"] and \
           len(attrs) == 1 and \
           attrs.has_key((ns_uri, "attr")) and \
           attrs.keys() == [(ns_uri, "attr")] and \
           attrs.get((ns_uri, "attr")) == "val" and \
           attrs.get((ns_uri, "attr"), 25) == "val" and \
           attrs.items() == [((ns_uri, "attr"), "val")] and \
           attrs.values() == ["val"] and \
           attrs.getValue((ns_uri, "attr")) == "val" and \
           attrs.getValueByQName("ns:attr") == "val" and \
           attrs.getNameByQName("ns:attr") == (ns_uri, "attr") and \
           attrs[(ns_uri, "attr")] == "val" and \
           attrs.getQNameByName((ns_uri, "attr")) == "ns:attr"
예제 #6
0
# regression test for SAX 2.0