コード例 #1
0
ファイル: test_action_alias_utils.py プロジェクト: hejin/st2
    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
ファイル: test_action_alias_utils.py プロジェクト: hejin/st2
    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')