How to use the pytmx.TiledElement function in PyTMX

To help you get started, we’ve selected a few PyTMX examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github bitcraft / PyTMX / tests / test_pytmx.py View on Github external
def test_from_xml_string_should_raise_on_TiledElement(self):
        with self.assertRaises(AttributeError):
            TiledElement.from_xml_string("<element></element>")
github bitcraft / PyTMX / tests / test_pytmx.py View on Github external
def setUp(self):
        self.element = TiledElement()
github bitcraft / PyTMX / tests / test_pytmx.py View on Github external
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)
github bitcraft / PyTMX / tests / test_pytmx.py View on Github external
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)