def test_page_placeholder_metadata(self):
        template = Template("""{% load fluent_contents_tags %}{% page_placeholder page "slot1" title="SlotTest1" role="s" %}""")

        # Test raw Placeholder extraction
        raw_placeholders = get_node_instances(template, PagePlaceholderNode)
        self.assertEqual(len(raw_placeholders), 1)
        self.assertEqual(raw_placeholders[0].get_slot(), 'slot1')
        self.assertEqual(raw_placeholders[0].get_title(), 'SlotTest1')
        self.assertEqual(raw_placeholders[0].get_role(), 's')

        # Now test the public API, that returns PlaceholderData objects.
        data = get_template_placeholder_data(template)
        self.assertEqual(len(data), 1)
        self.assertEqual(data[0].slot, 'slot1')
        self.assertEqual(data[0].title, 'SlotTest1')
        self.assertEqual(data[0].role, 's')

        # Test2: fallback code
        template = Template("""{% load fluent_contents_tags %}{% page_placeholder page "slot_test2" %}""")

        # Test raw Placeholder extraction
        raw_placeholders = get_node_instances(template, PagePlaceholderNode)
        self.assertEqual(len(raw_placeholders), 1)
        self.assertEqual(raw_placeholders[0].get_slot(), 'slot_test2')
        self.assertEqual(raw_placeholders[0].get_title(), 'Slot Test2')
        self.assertEqual(raw_placeholders[0].get_role(), None)

        # Test the public API
        data = get_template_placeholder_data(template)
        self.assertEqual(len(data), 1)
        self.assertEqual(data[0].slot, 'slot_test2')
        self.assertEqual(data[0].title, 'Slot Test2')
        self.assertEqual(data[0].role, 'm')  # Defaults to "main"
Alias for getLength.
dataset/ETHPy150Open edoburu/django-fluent-contents/fluent_contents/tests/test_templatetags.py/TemplateTagTests.test_page_placeholder_metadata--crossover with--dataset/ETHPy150Open 64studio/pdk/pdk/xml_legacy/sax/saxlib.py/AttributeList.__len__