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"))
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"))
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))
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))
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"]])
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)
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)
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"]])