From 3eadc8bc13e51a0df4d343df47fbdf85c946efad Mon Sep 17 00:00:00 2001 From: Semyon Proshev Date: Wed, 13 Jul 2016 19:41:27 +0300 Subject: [PATCH] PY-19085 Fixed: Unresolved attribute reference 'fullmatch' for class '__Regex' Add re.fullmatch and __Regex.fullmatch to skeletons --- python/helpers/python-skeletons/re.py | 21 +++++++++++++++++++ .../reAndRegexFullmatch.py | 4 ++++ ...Py3UnresolvedReferencesInspectionTest.java | 5 +++++ 3 files changed, 30 insertions(+) create mode 100644 python/testData/inspections/PyUnresolvedReferencesInspection3K/reAndRegexFullmatch.py diff --git a/python/helpers/python-skeletons/re.py b/python/helpers/python-skeletons/re.py index 151ddc9b7257..430c10d31977 100644 --- a/python/helpers/python-skeletons/re.py +++ b/python/helpers/python-skeletons/re.py @@ -34,6 +34,17 @@ def match(pattern, string, flags=0): pass +def fullmatch(pattern, string, flags=0): + """Matches the whole string. + + :type pattern: bytes | unicode | __Regex + :type string: T <= bytes | unicode + :type flags: int + :rtype: __Match[T] | None + """ + pass + + def split(pattern, string, maxsplit=0, flags=0): """Split string by the occurrences of pattern. @@ -144,6 +155,16 @@ class __Regex(object): """ pass + def fullmatch(self, string, pos=0, endpos=-1): + """Matches the whole string. + + :type string: T <= bytes | unicode + :type pos: int + :type endpos: int + :rtype: __Match[T] | None + """ + pass + def split(self, string, maxsplit=0): """Split string by the occurrences of pattern. diff --git a/python/testData/inspections/PyUnresolvedReferencesInspection3K/reAndRegexFullmatch.py b/python/testData/inspections/PyUnresolvedReferencesInspection3K/reAndRegexFullmatch.py new file mode 100644 index 000000000000..e1a2d97488af --- /dev/null +++ b/python/testData/inspections/PyUnresolvedReferencesInspection3K/reAndRegexFullmatch.py @@ -0,0 +1,4 @@ +import re + +a = re.compile('').fullmatch() +b = re.fullmatch('', '') \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/inspections/Py3UnresolvedReferencesInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/Py3UnresolvedReferencesInspectionTest.java index 0814f810f743..6a0a7e8b1516 100644 --- a/python/testSrc/com/jetbrains/python/inspections/Py3UnresolvedReferencesInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/Py3UnresolvedReferencesInspectionTest.java @@ -141,4 +141,9 @@ public class Py3UnresolvedReferencesInspectionTest extends PyTestCase { public void testDunderClass() { doTest(); } + + // PY-19085 + public void testReAndRegexFullmatch() { + doTest(); + } }