def test_bind_element_param_with_list_var(self): var = XmlVar(name="a", qname=QName("a"), default=list) params = {} status = ParserUtils.bind_element_param(params, var, 1) self.assertTrue(status) self.assertEqual({"a": [1]}, params) status = ParserUtils.bind_element_param(params, var, 2) self.assertTrue(status) self.assertEqual({"a": [1, 2]}, params)
def test_bind_element_param(self): var = XmlVar(name="a", qname=QName("a")) params = {} status = ParserUtils.bind_element_param(params, var, 1) self.assertTrue(status) self.assertEqual({"a": 1}, params) status = ParserUtils.bind_element_param(params, var, 2) self.assertFalse(status) self.assertEqual({"a": 1}, params)