Beispiel #1
0
    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)
Beispiel #2
0
 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)
Beispiel #3
0
 def test_match_int_fail_none(self):
     pattern = r"(\d).*"
     string = r"asdf"
     r = _match_int(pattern, string)
     self.assertIsNone(r)
Beispiel #4
0
 def test_match_int_succeed(self):
     pattern = r"(\d).*"
     string = r"1, 2, 3"
     r = _match_int(pattern, string)
     self.assertIsInstance(r, int)