Skip to content

Commit

Permalink
Added conformance checking for the "converter" field specifier parame… (
Browse files Browse the repository at this point in the history
#1813)

Added conformance checking for the "converter" field specifier parameter in dataclass_transform. None of the type checkers support it currently.
  • Loading branch information
erictraut authored Jul 20, 2024
1 parent dc1698d commit 75caed7
Show file tree
Hide file tree
Showing 9 changed files with 347 additions and 6 deletions.
48 changes: 48 additions & 0 deletions conformance/results/mypy/dataclasses_transform_converter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
conformant = "Unsupported"
notes = """
Converter parameter not yet supported.
"""
conformance_automated = "Fail"
errors_diff = """
Line 47: Expected 1 errors
Line 48: Expected 1 errors
Line 117: Expected 1 errors
Line 129: Expected 1 errors
Line 132: Expected 1 errors
Line 111: Unexpected errors ['dataclasses_transform_converter.py:111: error: Argument 1 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:111: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:111: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:111: error: Argument 4 to "DC2" has incompatible type "bytes"; expected "ConverterClass" [arg-type]', 'dataclasses_transform_converter.py:111: error: Argument 5 to "DC2" has incompatible type "list[Never]"; expected "int" [arg-type]']
Line 113: Unexpected errors ['dataclasses_transform_converter.py:113: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]']
Line 114: Unexpected errors ['dataclasses_transform_converter.py:114: error: Incompatible types in assignment (expression has type "str", variable has type "ConverterClass") [assignment]']
Line 115: Unexpected errors ['dataclasses_transform_converter.py:115: error: Incompatible types in assignment (expression has type "bytes", variable has type "ConverterClass") [assignment]']
Line 120: Unexpected errors ['dataclasses_transform_converter.py:120: error: Argument 1 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:120: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:120: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:120: error: Argument 4 to "DC2" has incompatible type "str"; expected "ConverterClass" [arg-type]', 'dataclasses_transform_converter.py:120: error: Argument 5 to "DC2" has incompatible type "str"; expected "int" [arg-type]', 'dataclasses_transform_converter.py:120: error: Argument 6 to "DC2" has incompatible type "tuple[tuple[str, str], tuple[str, str]]"; expected "dict[str, str]" [arg-type]']
"""
output = """
dataclasses_transform_converter.py:106: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:106: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:106: error: Argument 4 to "DC2" has incompatible type "bytes"; expected "ConverterClass" [arg-type]
dataclasses_transform_converter.py:106: error: Argument 5 to "DC2" has incompatible type "list[Never]"; expected "int" [arg-type]
dataclasses_transform_converter.py:107: error: Argument 1 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:107: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:107: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:107: error: Argument 4 to "DC2" has incompatible type "int"; expected "ConverterClass" [arg-type]
dataclasses_transform_converter.py:107: error: Argument 5 to "DC2" has incompatible type "list[Never]"; expected "int" [arg-type]
dataclasses_transform_converter.py:108: error: Argument 1 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:108: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:108: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:108: error: Argument 4 to "DC2" has incompatible type "str"; expected "ConverterClass" [arg-type]
dataclasses_transform_converter.py:108: error: Argument 5 to "DC2" has incompatible type "complex"; expected "int" [arg-type]
dataclasses_transform_converter.py:111: error: Argument 1 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:111: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:111: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:111: error: Argument 4 to "DC2" has incompatible type "bytes"; expected "ConverterClass" [arg-type]
dataclasses_transform_converter.py:111: error: Argument 5 to "DC2" has incompatible type "list[Never]"; expected "int" [arg-type]
dataclasses_transform_converter.py:113: error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]
dataclasses_transform_converter.py:114: error: Incompatible types in assignment (expression has type "str", variable has type "ConverterClass") [assignment]
dataclasses_transform_converter.py:115: error: Incompatible types in assignment (expression has type "bytes", variable has type "ConverterClass") [assignment]
dataclasses_transform_converter.py:118: error: Incompatible types in assignment (expression has type "int", variable has type "ConverterClass") [assignment]
dataclasses_transform_converter.py:120: error: Argument 1 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:120: error: Argument 2 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:120: error: Argument 3 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:120: error: Argument 4 to "DC2" has incompatible type "str"; expected "ConverterClass" [arg-type]
dataclasses_transform_converter.py:120: error: Argument 5 to "DC2" has incompatible type "str"; expected "int" [arg-type]
dataclasses_transform_converter.py:120: error: Argument 6 to "DC2" has incompatible type "tuple[tuple[str, str], tuple[str, str]]"; expected "dict[str, str]" [arg-type]
"""
48 changes: 48 additions & 0 deletions conformance/results/pyre/dataclasses_transform_converter.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
conformant = "Unsupported"
notes = """
Converter parameter not yet supported.
"""
conformance_automated = "Fail"
errors_diff = """
Line 47: Expected 1 errors
Line 48: Expected 1 errors
Line 117: Expected 1 errors
Line 129: Expected 1 errors
Line 132: Expected 1 errors
Line 111: Unexpected errors ['dataclasses_transform_converter.py:111:10 Incompatible parameter type [6]: In call `DC2.__init__`, for 1st positional argument, expected `int` but got `str`.', 'dataclasses_transform_converter.py:111:16 Incompatible parameter type [6]: In call `DC2.__init__`, for 2nd positional argument, expected `int` but got `str`.', 'dataclasses_transform_converter.py:111:22 Incompatible parameter type [6]: In call `DC2.__init__`, for 3rd positional argument, expected `int` but got `str`.', 'dataclasses_transform_converter.py:111:28 Incompatible parameter type [6]: In call `DC2.__init__`, for 4th positional argument, expected `ConverterClass` but got `bytes`.', 'dataclasses_transform_converter.py:111:35 Incompatible parameter type [6]: In call `DC2.__init__`, for 5th positional argument, expected `int` but got `List[Variable[_T]]`.']
Line 113: Unexpected errors ['dataclasses_transform_converter.py:113:0 Incompatible attribute type [8]: Attribute `field0` declared in class `DC2` has type `int` but is used as type `str`.']
Line 114: Unexpected errors ['dataclasses_transform_converter.py:114:0 Incompatible attribute type [8]: Attribute `field3` declared in class `DC2` has type `ConverterClass` but is used as type `str`.']
Line 115: Unexpected errors ['dataclasses_transform_converter.py:115:0 Incompatible attribute type [8]: Attribute `field3` declared in class `DC2` has type `ConverterClass` but is used as type `bytes`.']
Line 120: Unexpected errors ['dataclasses_transform_converter.py:120:10 Incompatible parameter type [6]: In call `DC2.__init__`, for 1st positional argument, expected `int` but got `str`.', 'dataclasses_transform_converter.py:120:16 Incompatible parameter type [6]: In call `DC2.__init__`, for 2nd positional argument, expected `int` but got `str`.', 'dataclasses_transform_converter.py:120:22 Incompatible parameter type [6]: In call `DC2.__init__`, for 3rd positional argument, expected `int` but got `str`.', 'dataclasses_transform_converter.py:120:28 Incompatible parameter type [6]: In call `DC2.__init__`, for 4th positional argument, expected `ConverterClass` but got `str`.', 'dataclasses_transform_converter.py:120:34 Incompatible parameter type [6]: In call `DC2.__init__`, for 5th positional argument, expected `int` but got `str`.', 'dataclasses_transform_converter.py:120:39 Incompatible parameter type [6]: In call `DC2.__init__`, for 6th positional argument, expected `Dict[str, str]` but got `Tuple[Tuple[str, str], Tuple[str, str]]`.']
"""
output = """
dataclasses_transform_converter.py:106:7 Incompatible parameter type [6]: In call `DC2.__init__`, for 2nd positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:106:13 Incompatible parameter type [6]: In call `DC2.__init__`, for 3rd positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:106:19 Incompatible parameter type [6]: In call `DC2.__init__`, for 4th positional argument, expected `ConverterClass` but got `bytes`.
dataclasses_transform_converter.py:106:26 Incompatible parameter type [6]: In call `DC2.__init__`, for 5th positional argument, expected `int` but got `List[Variable[_T]]`.
dataclasses_transform_converter.py:107:4 Incompatible parameter type [6]: In call `DC2.__init__`, for 1st positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:107:10 Incompatible parameter type [6]: In call `DC2.__init__`, for 2nd positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:107:16 Incompatible parameter type [6]: In call `DC2.__init__`, for 3rd positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:107:22 Incompatible parameter type [6]: In call `DC2.__init__`, for 4th positional argument, expected `ConverterClass` but got `int`.
dataclasses_transform_converter.py:107:25 Incompatible parameter type [6]: In call `DC2.__init__`, for 5th positional argument, expected `int` but got `List[Variable[_T]]`.
dataclasses_transform_converter.py:108:4 Incompatible parameter type [6]: In call `DC2.__init__`, for 1st positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:108:10 Incompatible parameter type [6]: In call `DC2.__init__`, for 2nd positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:108:16 Incompatible parameter type [6]: In call `DC2.__init__`, for 3rd positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:108:22 Incompatible parameter type [6]: In call `DC2.__init__`, for 4th positional argument, expected `ConverterClass` but got `str`.
dataclasses_transform_converter.py:108:28 Incompatible parameter type [6]: In call `DC2.__init__`, for 5th positional argument, expected `int` but got `complex`.
dataclasses_transform_converter.py:111:10 Incompatible parameter type [6]: In call `DC2.__init__`, for 1st positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:111:16 Incompatible parameter type [6]: In call `DC2.__init__`, for 2nd positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:111:22 Incompatible parameter type [6]: In call `DC2.__init__`, for 3rd positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:111:28 Incompatible parameter type [6]: In call `DC2.__init__`, for 4th positional argument, expected `ConverterClass` but got `bytes`.
dataclasses_transform_converter.py:111:35 Incompatible parameter type [6]: In call `DC2.__init__`, for 5th positional argument, expected `int` but got `List[Variable[_T]]`.
dataclasses_transform_converter.py:113:0 Incompatible attribute type [8]: Attribute `field0` declared in class `DC2` has type `int` but is used as type `str`.
dataclasses_transform_converter.py:114:0 Incompatible attribute type [8]: Attribute `field3` declared in class `DC2` has type `ConverterClass` but is used as type `str`.
dataclasses_transform_converter.py:115:0 Incompatible attribute type [8]: Attribute `field3` declared in class `DC2` has type `ConverterClass` but is used as type `bytes`.
dataclasses_transform_converter.py:118:0 Incompatible attribute type [8]: Attribute `field3` declared in class `DC2` has type `ConverterClass` but is used as type `int`.
dataclasses_transform_converter.py:120:10 Incompatible parameter type [6]: In call `DC2.__init__`, for 1st positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:120:16 Incompatible parameter type [6]: In call `DC2.__init__`, for 2nd positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:120:22 Incompatible parameter type [6]: In call `DC2.__init__`, for 3rd positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:120:28 Incompatible parameter type [6]: In call `DC2.__init__`, for 4th positional argument, expected `ConverterClass` but got `str`.
dataclasses_transform_converter.py:120:34 Incompatible parameter type [6]: In call `DC2.__init__`, for 5th positional argument, expected `int` but got `str`.
dataclasses_transform_converter.py:120:39 Incompatible parameter type [6]: In call `DC2.__init__`, for 6th positional argument, expected `Dict[str, str]` but got `Tuple[Tuple[str, str], Tuple[str, str]]`.
"""
2 changes: 1 addition & 1 deletion conformance/results/pyre/version.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "pyre 0.9.22"
test_duration = 2.8
test_duration = 3.4
Loading

0 comments on commit 75caed7

Please sign in to comment.