示例#1
0
文件: test_tank.py 项目: cpcloud/span
    def test_match_int_succeed_and_exceptions(self):
        pattern = r"(\d).*"
        string = r"1, 2, 3"
        r = _match_int(pattern, string)
        self.assertIsInstance(r, int)

        r, e = _match_int(pattern, string, get_exc=True)
        self.assertIsInstance(r, int)
        self.assertIsNone(e)
示例#2
0
文件: test_tank.py 项目: cpcloud/span
 def test_match_int_fail_none_and_exceptions(self):
     pattern = r"(\d).*"
     string = r"asdf"
     r, e = _match_int(pattern, string, get_exc=True)
     self.assertIsNone(r)
     self.assertIsInstance(e, Exception)
示例#3
0
文件: test_tank.py 项目: cpcloud/span
 def test_match_int_fail_none(self):
     pattern = r"(\d).*"
     string = r"asdf"
     r = _match_int(pattern, string)
     self.assertIsNone(r)
示例#4
0
文件: test_tank.py 项目: cpcloud/span
 def test_match_int_succeed(self):
     pattern = r"(\d).*"
     string = r"1, 2, 3"
     r = _match_int(pattern, string)
     self.assertIsInstance(r, int)