Ejemplo n.º 1
0
	def testGetAttributes(self):
		"""
		This method tests :meth:`foundations.parsers.SectionsFileParser.getAttributes` method.
		"""

		for type, file in STANDARD_FILES.iteritems():
			sectionsFileParser = SectionsFileParser(file)
			sectionsFileParser.read() and sectionsFileParser.parse(rawSections=STANDARD_FILES_RAW_SECTIONS[type])
			for section in STANDARD_FILES_SECTIONS_AND_ATTRIBUTES[type]:
				self.assertListEqual(sectionsFileParser.getAttributes(
				section, orderedDictionary=True, stripNamespaces=True).keys(),
				STANDARD_FILES_SECTIONS_AND_ATTRIBUTES[type][section]["stripped"])
				self.assertListEqual(sectionsFileParser.getAttributes(section).keys(),
				STANDARD_FILES_SECTIONS_AND_ATTRIBUTES[type][section]["namespaced"])
Ejemplo n.º 2
0
    def testGetAttributes(self):
        """
		Tests :meth:`foundations.parsers.SectionsFileParser.getAttributes` method.
		"""

        for type, file in STANDARD_FILES.iteritems():
            sectionsFileParser = SectionsFileParser(file)
            sectionsFileParser.parse(
                rawSections=STANDARD_FILES_RAW_SECTIONS[type])
            for section in STANDARD_FILES_SECTIONS_AND_ATTRIBUTES[type]:
                self.assertListEqual(
                    sectionsFileParser.getAttributes(
                        section, stripNamespaces=True).keys(),
                    STANDARD_FILES_SECTIONS_AND_ATTRIBUTES[type][section]
                    ["stripped"])
                self.assertListEqual(
                    sectionsFileParser.getAttributes(section).keys(),
                    STANDARD_FILES_SECTIONS_AND_ATTRIBUTES[type][section]
                    ["namespaced"])