assert(st['a']['z'] == '\n')
s.assertRaises(InvalidStatusFile, s.parse, "a")
s.assertRaises(InvalidStatusFile, s.parse, "a\n(\n)")
+ s.assertRaises(InvalidStatusFile, s.parse, "a.b:c")
def test_unique(s):
s.assertRaises(InvalidStatusFile, s.parse, "a:1\na:1")
# the continuation of entry must be at consecutive lines
s.assertRaises(InvalidStatusFile, s.parse, "a:\n:\n\n:z")
s.assertRaises(InvalidStatusFile, s.parse, "a:\n#\n:\n")
+ # All subtrees must be closed
+ s.assertRaises(InvalidStatusFile, s.parse, "a(")
+ s.assertRaises(InvalidStatusFile, s.parse, "a(\nb(\n)\n")
# Valid entries
st = s.parse("a:\t\n\t \t : \t\n:"); assert(st['a'] == '\t\n \t\n')
st = s.parse(" a : \n :x"); assert(st['a'] == ' \nx')
s.assertRaises(InvalidStatusFile, s.parse, "a( #comm\n)")
s.assertRaises(InvalidStatusFile, s.parse, "a(\n)#comm")
+ def test_update(s):
+ st1 = s.parse('a:1\nb(\nc:3\n:4\nz:0\n)\nd:5')
+ st2 = s.parse('a:A\nb(\nc:C\nx:y\n)\ne:E')
+ st12 = s.parse('a:A\nb(\nc:C\nx:y\nz:0\n)\nd:5\ne:E')
+ st3 = s.parse('a(\n)')
+ st4 = s.parse('b:0')
+ st1.update(st2)
+ assert(st1 == st12)
+ s.assertRaises(TypeError, st1.update, st3)
+ s.assertRaises(TypeError, st1.update, st4)
+
def test_file_utf8(s):
st = Status()
f = tempfile.TemporaryFile(mode='w+t')
st.read(f=f)
assert(st['a'] == '\xc3\xa1\xc5\xa1\xc4\x8f\xc3\xab\xc3\xa5')
- def test_file_wr_eq_l2(s):
+ def test_file_w_r_eq_l2(s):
st = s.parse('a:' + u'ášďě'.encode('l2') + """
b(
c(