コード例 #1
0
    def testElementExists(self):
        """
		This method tests :meth:`foundations.parsers.PlistFileParser.elementExists` method.
		"""

        plistFileParser = PlistFileParser(PLIST_FILE)
        plistFileParser.parse()
        self.assertTrue(plistFileParser.elementExists("String A"))
        self.assertFalse(plistFileParser.elementExists("String Nemo"))
コード例 #2
0
    def testElementExists(self):
        """
		Tests :meth:`foundations.parsers.PlistFileParser.elementExists` method.
		"""

        plistFileParser = PlistFileParser(PLIST_FILE)
        plistFileParser.parse()
        self.assertTrue(plistFileParser.elementExists("String A"))
        self.assertFalse(plistFileParser.elementExists("String Nemo"))
コード例 #3
0
    def testGetValue(self):
        """
		Tests :meth:`foundations.parsers.PlistFileParser.getValue` method.
		"""

        plistFileParser = PlistFileParser(PLIST_FILE)
        plistFileParser.parse()
        for item in foundations.walkers.dictionariesWalker(PLIST_FILE_CONTENT):
            path, element, value = item
            self.assertEqual(value, plistFileParser.getValue(element))
コード例 #4
0
    def testGetValue(self):
        """
		This method tests :meth:`foundations.parsers.PlistFileParser.getValue` method.
		"""

        plistFileParser = PlistFileParser(PLIST_FILE)
        plistFileParser.parse()
        for item in foundations.walkers.dictionariesWalker(PLIST_FILE_CONTENT):
            path, element, value = item
            self.assertEqual(value, plistFileParser.getValue(element))
コード例 #5
0
	def testFilterValues(self):
		"""
		This method tests :meth:`foundations.parsers.PlistFileParser.filterValues` method.
		"""

		plistFileParser = PlistFileParser(PLIST_FILE)
		plistFileParser.parse()
		self.assertEqual(plistFileParser.filterValues(r"String A"), [PLIST_FILE_CONTENT["String A"]])
		self.assertEqual(sorted(plistFileParser.filterValues(r"String.*")), sorted([PLIST_FILE_CONTENT["String A"],
																	PLIST_FILE_CONTENT["Dictionary A"]["String B"],
																	PLIST_FILE_CONTENT["Dictionary A"]["String C"]]))
		self.assertEqual(plistFileParser.filterValues(r"Date A"), [PLIST_FILE_CONTENT["Date A"]])
コード例 #6
0
    def testParse(self):
        """
		Tests :meth:`foundations.parsers.PlistFileParser.parse` method.
		"""

        plistFileParser = PlistFileParser(PLIST_FILE)
        self.assertTrue(plistFileParser.parse())
        self.assertDictEqual(plistFileParser.elements, PLIST_FILE_CONTENT)
コード例 #7
0
    def testParse(self):
        """
		This method tests :meth:`foundations.parsers.PlistFileParser.parse` method.
		"""

        plistFileParser = PlistFileParser(PLIST_FILE)
        self.assertTrue(plistFileParser.parse())
        self.assertDictEqual(plistFileParser.elements, PLIST_FILE_CONTENT)
コード例 #8
0
    def testFilterValues(self):
        """
		This method tests :meth:`foundations.parsers.PlistFileParser.filterValues` method.
		"""

        plistFileParser = PlistFileParser(PLIST_FILE)
        plistFileParser.parse()
        self.assertEqual(plistFileParser.filterValues(r"String A"),
                         [PLIST_FILE_CONTENT["String A"]])
        self.assertEqual(
            sorted(plistFileParser.filterValues(r"String.*")),
            sorted([
                PLIST_FILE_CONTENT["String A"],
                PLIST_FILE_CONTENT["Dictionary A"]["String B"],
                PLIST_FILE_CONTENT["Dictionary A"]["String C"]
            ]))
        self.assertEqual(plistFileParser.filterValues(r"Date A"),
                         [PLIST_FILE_CONTENT["Date A"]])