diff --git a/python/helpers/python-skeletons/_csv.py b/python/helpers/python-skeletons/_csv.py index 8d5aa3ed6b76..47a51a3ce9e5 100644 --- a/python/helpers/python-skeletons/_csv.py +++ b/python/helpers/python-skeletons/_csv.py @@ -1,10 +1,13 @@ """Skeleton for 'csv' stdlib module.""" -def register_dialect(name, dialect=None, **fmtparams=None): +import _csv + + +def register_dialect(name, dialect=None, **fmtparams): """Associate dialect with name. :type name: string - :type dialect: Dialect + :type dialect: _csv.Dialect :rtype: None """ pass \ No newline at end of file diff --git a/python/testData/inspections/PyTypeCheckerInspection/CsvRegisterDialect/_csv.py b/python/testData/inspections/PyTypeCheckerInspection/CsvRegisterDialect/_csv.py new file mode 100644 index 000000000000..e7d846d84c79 --- /dev/null +++ b/python/testData/inspections/PyTypeCheckerInspection/CsvRegisterDialect/_csv.py @@ -0,0 +1,5 @@ +def register_dialect(name, dialect): + pass + +class Dialect(object): + pass \ No newline at end of file diff --git a/python/testData/inspections/PyTypeCheckerInspection/CsvRegisterDialect/a.py b/python/testData/inspections/PyTypeCheckerInspection/CsvRegisterDialect/a.py new file mode 100644 index 000000000000..2b0991c17424 --- /dev/null +++ b/python/testData/inspections/PyTypeCheckerInspection/CsvRegisterDialect/a.py @@ -0,0 +1,6 @@ +import csv + +class A(object): + pass + +csv.register_dialect(A(), A(), delimiter=':', quoting=csv.QUOTE_NONE) \ No newline at end of file diff --git a/python/testData/inspections/PyTypeCheckerInspection/CsvRegisterDialect/csv.py b/python/testData/inspections/PyTypeCheckerInspection/CsvRegisterDialect/csv.py new file mode 100644 index 000000000000..d7cb938733ed --- /dev/null +++ b/python/testData/inspections/PyTypeCheckerInspection/CsvRegisterDialect/csv.py @@ -0,0 +1,3 @@ +from _csv import register_dialect + +__all__ = ["register_dialect"] \ No newline at end of file diff --git a/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java b/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java index f851a110c516..be038d980254 100644 --- a/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java +++ b/python/testSrc/com/jetbrains/python/inspections/PyTypeCheckerInspectionTest.java @@ -326,4 +326,9 @@ public class PyTypeCheckerInspectionTest extends PyTestCase { public void testFunctionReturnType() { doTest(); } + + // PY-19522 + public void testCsvRegisterDialect() { + doMultiFileTest(); + } }