def test_property_is_list(self): restrictions = Restrictions() self.assertFalse(restrictions.is_list) restrictions.max_occurs = 1 self.assertFalse(restrictions.is_list) restrictions.max_occurs = 2 self.assertTrue(restrictions.is_list)
def test_asdict_with_implied_types(self): restrictions = Restrictions(min_occurs=1, max_occurs=4) self.assertEqual({ "max_occurs": 4, "min_occurs": 1 }, restrictions.asdict()) restrictions.min_occurs = 0 self.assertEqual({"max_occurs": 4}, restrictions.asdict()) restrictions.max_occurs = sys.maxsize self.assertEqual({}, restrictions.asdict())