class TestPathParser(unittest.TestCase): def setUp(self): self.parser = PathParser() def test_parseValidInput(self): propertyPath = '123.abc.some_name' segments = self.parser.parse(propertyPath) self.assertEqual(3, len(segments)) self.assertEqual('123', segments[0]) self.assertEqual('abc', segments[1]) self.assertEqual('some_name', segments[2])
def parseLine(self, line): assert line is not None pathAndValue = self.splitToPathAndValue(line) path = pathAndValue[0] value = pathAndValue[1] pathParser = PathParser() pathSegments = pathParser.parse(path) result = {"segments": pathSegments, "value": value} return result