def test_dump_dict(self): data = dumps({'a': {'d': 1}}) loads(data) self.assertEquals(data, """\ a { d = 1 } """)
def test_dump_list(self): data = dumps({'a': ['a', 'b', 'c']}) self.assertEquals(data, """\ a = { a b c } """)
def test_object_order_is_kept(self): """Verify that the items in objects are kept in order.""" order = random.sample(range(100), 100) string = "\n".join("property%d = %d" % (i, i) for i in order) result = loads(string) for (key, value), i in zip(result.items(), order): self.assertEquals(value, i) new_string = dumps(result) self.assertEquals(string, str(new_string).rstrip())
def test_dump_false_bool(self): data = dumps({'a': False}) loads(data) self.assertEquals(data, """\ a = false """)
def test_dump_true_bool(self): data = dumps({'a': True}) loads(data) self.assertEquals(data, """\ a = true """)
def test_escape_space(self): data = dumps({'a b': 1}) loads(data) self.assertEquals(data, """\ "a b" = 1 """)