# # Copyright (c) 2002, Benja Fallenstein # # You may use and distribute under the terms of either the GNU Lesser # General Public License, either version 2 of the license or, # at your choice, any later version. Alternatively, you may use and # distribute under the terms of the XPL. # # See the LICENSE.lgpl and LICENSE.xpl files for the specific terms of # the licenses. # # This software is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the README # file for more details. # import gzz, java Class = gzz.storm.headers.VerbatimHeader822 execfile('lava/test/gzz/storm/headers/VerbatimHeaderLines822.meta') def testVerbatimHeader822(): h = Class() h.add("foo", "BAR") h.add("fOo", "BengBie") h.add("bAR", "baz") h.add("b-leh", "x") #print list(h.getLines()) makeAssertions(h) h2 = Class(h) h2.add("Foo", "yuck") h2.add("XXX", "YYY") makeAssertions(h) assert list(h2.getLines()) == [ "foo: BAR", "fOo: BengBie", "bAR: baz", "b-leh: x", "Foo: yuck", "XXX: YYY"] vals = ["BAR", "BengBie", "yuck"] assert [x in vals for x in h.getAll("foO")] def makeAssertions(h): assert list(h.getLines()) == [ "foo: BAR", "fOo: BengBie", "bAR: baz", "b-leh: x"] assert [x in ["BAR", "BengBie"] for x in h.getAll("FOO")] assert [x in ["baz"] for x in h.getAll("bar")] assert h.get("B-Leh") == "x" try: h.get("foo") except gzz.storm.headers.MoreThanOneElementException: pass else: assert 0 try: h.get("bexx") except java.util.NoSuchElementException: pass else: assert 0