def test_keys(self): w = Wax() w.a = 1 w.z = 2 w.c = 3 w.b = 4 self.assertEquals(w.keys(), ['a', 'z', 'c', 'b'])
def test_keys(self): w = Wax() w.a = 1 w.z = 2 w.c = 3 w.b = 4 self.assertEquals(w.keys(), ['a','z','c','b'])
def test_add_with_comments(self): w1 = Wax(a=1) w1._add_comment('foo\nbar') w1.b = 'a string' w1._add_comment('abc\ndef\nghi') self.assertEquals(w1.keys(), ['a', 'b']) w2 = Wax() w2 += w1 self.assertEquals(w2._comments[0], 'foo\nbar') out = str(w2) self.assertTrue('# foo\n# bar\n' in out)
def test_add_with_annotations(self): w1 = Wax(a=1) w1._set_annotation('a', 'foo\nbar') w1.b = 'a string' w1._set_annotation('b', 'abc\ndef\nghi') self.assertEquals(w1.keys(), ['a', 'b']) w2 = Wax() w2 += w1 self.assertEquals(w2._annotations['a'], 'foo\nbar') self.assertEquals(w2._annotations['b'], 'abc\ndef\nghi') out = str(w2) self.assertTrue('; foo\n; bar\n' in out)