Пример #1
0
    def testDefaultParsing(self):
        stream = 'some meaningful value1 something else skippable value2 still more skip.'

        start = len('some meaningful ')
        self.assertTrue(DefaultParser.is_applicable(stream[start]), 'Should be parsable.')
        _, value, _ = DefaultParser.parse(start, stream)
        self.assertEqual(value, 'value1')

        start = len('some meaningful value1 something else skippable ')
        self.assertTrue(DefaultParser.is_applicable(stream[start]), 'Should be parsable.')
        _, value, _ = DefaultParser.parse(start, stream)
        self.assertEqual(value, 'value2')
Пример #2
0
    def testDefaultParsing(self):
        stream = 'some meaningful value1 something else skippable value2 still more skip.'

        start = len('some meaningful ')
        self.assertTrue(DefaultParser.is_applicable(stream[start]),
                        'Should be parsable.')
        _, value, _ = DefaultParser.parse(start, stream)
        self.assertEqual(value, 'value1')

        start = len('some meaningful value1 something else skippable ')
        self.assertTrue(DefaultParser.is_applicable(stream[start]),
                        'Should be parsable.')
        _, value, _ = DefaultParser.parse(start, stream)
        self.assertEqual(value, 'value2')
Пример #3
0
    def testEndStringParsing(self):
        stream = 'some meaningful value1'

        start = len('some meaningful ')
        self.assertTrue(DefaultParser.is_applicable(stream[start]), 'Should be parsable.')
        _, value, _ = DefaultParser.parse(start, stream)
        self.assertEqual(value, 'value1')
Пример #4
0
    def testEndStringParsing(self):
        stream = 'some meaningful value1'

        start = len('some meaningful ')
        self.assertTrue(DefaultParser.is_applicable(stream[start]),
                        'Should be parsable.')
        _, value, _ = DefaultParser.parse(start, stream)
        self.assertEqual(value, 'value1')