Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_from_xml_string_should_raise_on_TiledElement(self):
with self.assertRaises(AttributeError):
TiledElement.from_xml_string("<element></element>")
def setUp(self):
self.element = TiledElement()
def test_reserved_names_check_disabled_with_option(self):
""" Reserved names are checked from any attributes in the instance
after it is created. Instance attributes are defaults from the
specification. We check that new properties are not named same
as existing attributes.
Check that passing an option will disable the check
"""
pytmx.TiledElement.allow_duplicate_names = True
self.element.name = 'foo'
items = {'name': None}
result = self.element._contains_invalid_property_name(items.items())
self.assertFalse(result)
def test_reserved_names_check_disabled_with_option(self):
pytmx.TiledElement.allow_duplicate_names = False
pytmx.TiledMap(allow_duplicate_names=True)
self.assertTrue(pytmx.TiledElement.allow_duplicate_names)