def testIncompleteStringParsing(self):
        stream = 'some meaningful "spaced .'

        start = len('some meaningful ')
        self.assertTrue(StringValueParser.is_applicable(stream[start]), 'Should be parsable.')
        try:
            StringValueParser.parse(start, stream)
            self.assertTrue(False, 'Parsing failure expected.')
        except content.ParseException:
            self.assertTrue(True)
Exemplo n.º 2
0
    def testIncompleteStringParsing(self):
        stream = 'some meaningful "spaced .'

        start = len('some meaningful ')
        self.assertTrue(StringValueParser.is_applicable(stream[start]),
                        'Should be parsable.')
        try:
            StringValueParser.parse(start, stream)
            self.assertTrue(False, 'Parsing failure expected.')
        except content.ParseException:
            self.assertTrue(True)
    def testEscapedStringParsing(self):
        stream = 'some meaningful "spaced \\"value1" something else skippable ' \
                 '"double spaced value2" still more skip.'

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

        start = len('some meaningful "spaced \\"value1" something else skippable ')
        self.assertTrue(StringValueParser.is_applicable(stream[start]), 'Should be parsable.')
        _, value, _ = StringValueParser.parse(start, stream)
        self.assertEqual(value, 'double spaced value2')

        start = len(stream) - 2
        self.assertFalse(StringValueParser.is_applicable(stream[start]), 'Should not be parsable.')
    def testEndStringParsing(self):
        stream = 'some meaningful "spaced value1"'

        start = len('some meaningful ')
        self.assertTrue(StringValueParser.is_applicable(stream[start]), 'Should be parsable.')
        _, value, _ = StringValueParser.parse(start, stream)
        self.assertEqual(value, 'spaced value1')
Exemplo n.º 5
0
    def testEndStringParsing(self):
        stream = 'some meaningful "spaced value1"'

        start = len('some meaningful ')
        self.assertTrue(StringValueParser.is_applicable(stream[start]),
                        'Should be parsable.')
        _, value, _ = StringValueParser.parse(start, stream)
        self.assertEqual(value, 'spaced value1')
Exemplo n.º 6
0
    def testEscapedStringParsing(self):
        stream = 'some meaningful "spaced \\"value1" something else skippable ' \
                 '"double spaced value2" still more skip.'

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

        start = len(
            'some meaningful "spaced \\"value1" something else skippable ')
        self.assertTrue(StringValueParser.is_applicable(stream[start]),
                        'Should be parsable.')
        _, value, _ = StringValueParser.parse(start, stream)
        self.assertEqual(value, 'double spaced value2')

        start = len(stream) - 2
        self.assertFalse(StringValueParser.is_applicable(stream[start]),
                         'Should not be parsable.')