def _set_guest_count(self, age_code, count): if age_code not in self._age_map.keys(): guest_count = XmlNode(constants.GUEST_COUNT) self._age_map[age_code] = self._guest_counts.add_child(guest_count) guest_count = self._age_map[age_code] guest_count.set_attribute(constants.AGE_QUALIFYING_CODE, age_code) guest_count.set_attribute(constants.COUNT, count)
def test_set_attribute(self): raw_node = XmlNode() raw_node.set_attribute('two', 2) self.assertEqual(str(raw_node), '<XmlNode two="2"/>') raw_node.set_attribute('two', 3) self.assertEqual(str(raw_node), '<XmlNode two="3"/>') raw_node.set_attribute('two', 'TWO') self.assertEqual(str(raw_node), '<XmlNode two="TWO"/>')