Example #1
0
    def test_numbers(self):
        MAT = SourceString()
        MAT.set_string('1234.5')
        MAT2 = SourceString()
        MAT2.set_string('-1234.5')

        assert MAT.match_string_pattern(pat.number) == '1234'
        assert MAT2.match_string_pattern(pat.number) == ''
Example #2
0
    def test_alphas(self):
        MAT = SourceString()
        MAT.set_string('hello world')
        MAT2 = SourceString()
        MAT2.set_string('HEllo world')

        assert MAT.match_string_pattern(pat.alphal) == 'hello'
        assert MAT2.match_string_pattern(pat.alphau) == 'HE'
        assert MAT.match_string_pattern(pat.alpha) == 'hello'
Example #3
0
    def test_specials(self):
        MAT = SourceString()
        MAT.set_string('hello.world')
        MAT2 = SourceString()
        MAT2.set_string('-1234')

        assert MAT.match_string_pattern(*pat.identifier) == 'hello'
        assert MAT.match_string_pattern(*pat.qualified) == 'hello.world'
        assert MAT2.match_string_pattern(*pat.integer) == '-1234'