def test_named_tuple(self): o = Object() o.name = "alice" o.email = "*****@*****.**" o.firstName = "Alice" o.lastName = "Wonderland" o.company = "Microsoft Corporation" o.showTutorial = True o.uid = 2156 o.password = None user_object = '<obj>' \ '<att id="name"><val>alice</val></att>' \ '<att id="email"><val>[email protected]</val></att>' \ '<att id="firstName"><val>Alice</val></att>' \ '<att id="lastName"><val>Wonderland</val></att>' \ '<att id="company"><val>Microsoft Corporation</val></att>' \ '<att id="showTutorial"><val>true</val></att>' \ '<att id="uid"><val>2156</val></att>' \ '<att id="password" />' \ '</obj>' self.assertEqual(base_convert.TestXML._toxmlstr(o), user_object)
def test_null(self): o = Object() o.company = None self.assertEqual(base_convert.TestJSON._tojsonstr(o), '{"company": null}')