本文整理汇总了Python中solution.Solution.isMatch方法的典型用法代码示例。如果您正苦于以下问题:Python Solution.isMatch方法的具体用法?Python Solution.isMatch怎么用?Python Solution.isMatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类solution.Solution
的用法示例。
在下文中一共展示了Solution.isMatch方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_1
# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import isMatch [as 别名]
def test_1():
sol = Solution()
assert not sol.isMatch('aa', 'a')
assert sol.isMatch('aa', 'aa')
assert not sol.isMatch('aaa', 'aa')
assert sol.isMatch('aa', 'a*')
assert sol.isMatch('aa', '.*')
assert sol.isMatch('ab', '.*')
assert sol.isMatch('aab', 'c*a*b')
assert sol.isMatch('abcef', 'ab..*.f')
assert not sol.isMatch('abcf', 'ab..*.f')
assert sol.isMatch('aa', 'aab*a*')
assert sol.isMatch('aabb', 'aab*a*')
示例2: test1
# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import isMatch [as 别名]
def test1(self):
s = Solution()
input_str = 'aa'
p = 'a'
res = s.isMatch(input_str, p)
print res
self.assertFalse(res)
示例3: test3
# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import isMatch [as 别名]
def test3(self):
s = Solution()
input_str = 'aab'
p = 'c*a*b'
res = s.isMatch(input_str, p)
print res
self.assertTrue(res)
示例4: test4
# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import isMatch [as 别名]
def test4(self):
s = Solution()
input_str = 'aaaaaaaaaaaaab'
p = 'a*a*a*a*a*a*a*a*a*a*c'
res = s.isMatch(input_str, p)
print res
self.assertFalse(res)
示例5: test_4
# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import isMatch [as 别名]
def test_4():
sol = Solution()
assert sol.isMatch('', '.*')
示例6: test_3
# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import isMatch [as 别名]
def test_3():
sol = Solution()
assert sol.isMatch('aaa', '.*')
示例7: test_2
# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import isMatch [as 别名]
def test_2():
sol = Solution()
assert sol.isMatch('aaa', 'a*a')
assert not sol.isMatch('aaaaaaaaaaaaab', 'a*a*a*a*a*a*a*a*a*a*c')
assert not sol.isMatch('aaba', 'ab*a*c*a')
assert sol.isMatch('a', 'ab*')
示例8: Solution
# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import isMatch [as 别名]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from solution import Solution
s = "abefcdgiescdfimde"
p = "ab*cd?i*de"
sol = Solution()
res = sol.isMatch(s, p)
print(res)
示例9: test_7
# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import isMatch [as 别名]
def test_7():
sol = Solution()
assert not sol.isMatch("bb", "..*c")
示例10: test_5
# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import isMatch [as 别名]
def test_5():
sol = Solution()
assert sol.isMatch("cbaacacaaccbaabcb", "c*b*b*.*ac*.*bc*a*")
示例11: test2
# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import isMatch [as 别名]
def test2(self):
sol = Solution()
s = 'abcd'
p = "a?*d"
res = sol.isMatch(s, p)
print res
示例12: test_6
# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import isMatch [as 别名]
def test_6():
sol = Solution()
assert not sol.isMatch('ab', 'a*c')
示例13: test_0
# 需要导入模块: from solution import Solution [as 别名]
# 或者: from solution.Solution import isMatch [as 别名]
def test_0():
sol = Solution()
assert sol.isMatch('', '')
assert not sol.isMatch('', 'a')
assert not sol.isMatch('a', '')
assert sol.isMatch('', '*')