Skip to content

Commit 55400b5

Browse files
authored
Did a pass on the new deprecated tests to make them stylistically more consistent with existing tests. (#1823)
* Ran code formatter * Moved import statements to top of module * Fixed spelling issues so code passes spell checking * Marked usage of imported deprecated symbol as an optional error
1 parent cbf18f8 commit 55400b5

File tree

11 files changed

+110
-95
lines changed

11 files changed

+110
-95
lines changed

conformance/results/mypy/directives_deprecated.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ Does not support @deprecated.
44
"""
55
conformance_automated = "Fail"
66
errors_diff = """
7-
Line 15: Expected 1 errors
8-
Line 23: Expected 1 errors
7+
Line 18: Expected 1 errors
98
Line 24: Expected 1 errors
10-
Line 29: Expected 1 errors
11-
Line 40: Expected 1 errors
9+
Line 25: Expected 1 errors
10+
Line 30: Expected 1 errors
1211
Line 41: Expected 1 errors
13-
Line 43: Expected 1 errors
14-
Line 46: Expected 1 errors
12+
Line 42: Expected 1 errors
13+
Line 44: Expected 1 errors
1514
Line 47: Expected 1 errors
16-
Line 57: Expected 1 errors
17-
Line 87: Expected 1 errors
15+
Line 48: Expected 1 errors
16+
Line 58: Expected 1 errors
17+
Line 69: Expected 1 errors
18+
Line 98: Expected 1 errors
1819
"""
1920
output = """
2021
"""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version = "mypy 1.11.0"
2-
test_duration = 1.4
2+
test_duration = 1.2

conformance/results/pyre/directives_deprecated.toml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,18 @@ Does not support @deprecated.
44
"""
55
conformance_automated = "Fail"
66
errors_diff = """
7-
Line 15: Expected 1 errors
8-
Line 23: Expected 1 errors
7+
Line 18: Expected 1 errors
98
Line 24: Expected 1 errors
10-
Line 29: Expected 1 errors
11-
Line 40: Expected 1 errors
9+
Line 25: Expected 1 errors
10+
Line 30: Expected 1 errors
1211
Line 41: Expected 1 errors
13-
Line 43: Expected 1 errors
14-
Line 46: Expected 1 errors
12+
Line 42: Expected 1 errors
13+
Line 44: Expected 1 errors
1514
Line 47: Expected 1 errors
16-
Line 57: Expected 1 errors
17-
Line 87: Expected 1 errors
15+
Line 48: Expected 1 errors
16+
Line 58: Expected 1 errors
17+
Line 69: Expected 1 errors
18+
Line 98: Expected 1 errors
1819
"""
1920
output = """
2021
"""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version = "pyre 0.9.22"
2-
test_duration = 1.8
2+
test_duration = 2.6

conformance/results/pyright/directives_deprecated.toml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,29 @@ Does not report error for deprecated magic methods.
44
"""
55
conformance_automated = "Fail"
66
errors_diff = """
7-
Line 40: Expected 1 errors
87
Line 41: Expected 1 errors
9-
Line 47: Expected 1 errors
10-
Line 33: Unexpected errors ['directives_deprecated.py:33:7 - error: The class "Ham" is deprecated']
8+
Line 42: Expected 1 errors
9+
Line 48: Expected 1 errors
1110
"""
1211
output = """
13-
directives_deprecated.py:15:44 - error: The class "Ham" is deprecated
12+
directives_deprecated.py:18:44 - error: The class "Ham" is deprecated
1413
  Use Spam instead (reportDeprecated)
15-
directives_deprecated.py:23:9 - error: The function "norwegian_blue" is deprecated
16-
  It is pining for the fiords (reportDeprecated)
17-
directives_deprecated.py:24:13 - error: The function "norwegian_blue" is deprecated
18-
  It is pining for the fiords (reportDeprecated)
19-
directives_deprecated.py:29:9 - error: The function "foo" is deprecated
14+
directives_deprecated.py:24:9 - error: The function "norwegian_blue" is deprecated
15+
  It is pining for the fjords (reportDeprecated)
16+
directives_deprecated.py:25:13 - error: The function "norwegian_blue" is deprecated
17+
  It is pining for the fjords (reportDeprecated)
18+
directives_deprecated.py:30:9 - error: The function "foo" is deprecated
2019
  Only str will be allowed (reportDeprecated)
21-
directives_deprecated.py:33:7 - error: The class "Ham" is deprecated
20+
directives_deprecated.py:34:7 - error: The class "Ham" is deprecated
2221
  Use Spam instead (reportDeprecated)
23-
directives_deprecated.py:43:6 - error: The getter for property "greasy" is deprecated
22+
directives_deprecated.py:44:6 - error: The getter for property "greasy" is deprecated
2423
  All spam will be equally greasy (reportDeprecated)
25-
directives_deprecated.py:46:6 - error: The setter for property "shape" is deprecated
24+
directives_deprecated.py:47:6 - error: The setter for property "shape" is deprecated
2625
  Shapes are becoming immutable (reportDeprecated)
27-
directives_deprecated.py:57:9 - error: The function "lorem" is deprecated
26+
directives_deprecated.py:58:1 - error: The function "invocable" is deprecated
2827
  Deprecated (reportDeprecated)
29-
directives_deprecated.py:87:13 - error: The method "foo" in class "Fooable" is deprecated
28+
directives_deprecated.py:69:1 - error: The function "lorem" is deprecated
29+
  Deprecated (reportDeprecated)
30+
directives_deprecated.py:98:7 - error: The method "foo" in class "SupportsFoo1" is deprecated
3031
  Deprecated (reportDeprecated)
3132
"""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version = "pyright 1.1.373"
2-
test_duration = 1.2
2+
test_duration = 1.4

conformance/results/pytype/directives_deprecated.toml

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,24 @@ Does not support @deprecated.
44
"""
55
conformance_automated = "Fail"
66
errors_diff = """
7-
Line 23: Expected 1 errors
87
Line 24: Expected 1 errors
9-
Line 29: Expected 1 errors
10-
Line 40: Expected 1 errors
8+
Line 25: Expected 1 errors
9+
Line 30: Expected 1 errors
1110
Line 41: Expected 1 errors
12-
Line 43: Expected 1 errors
13-
Line 46: Expected 1 errors
11+
Line 42: Expected 1 errors
12+
Line 44: Expected 1 errors
1413
Line 47: Expected 1 errors
15-
Line 57: Expected 1 errors
16-
Line 87: Expected 1 errors
17-
Line 16: Unexpected errors ['File "directives_deprecated.py", line 16, in <module>: Can\\'t find module \\'_directives_deprecated_library\\'. [import-error]']
18-
Line 18: Unexpected errors ['File "directives_deprecated.py", line 18, in <module>: typing_extensions.deprecated not supported yet [not-supported-yet]']
19-
Line 66: Unexpected errors ['File "directives_deprecated.py", line 66, in <module>: typing.override not supported yet [not-supported-yet]']
14+
Line 48: Expected 1 errors
15+
Line 58: Expected 1 errors
16+
Line 69: Expected 1 errors
17+
Line 98: Expected 1 errors
18+
Line 10: Unexpected errors ['File "directives_deprecated.py", line 10, in <module>: typing.override not supported yet [not-supported-yet]']
19+
Line 11: Unexpected errors ['File "directives_deprecated.py", line 11, in <module>: typing_extensions.deprecated not supported yet [not-supported-yet]']
20+
Line 19: Unexpected errors ['File "directives_deprecated.py", line 19, in <module>: Can\\'t find module \\'_directives_deprecated_library\\'. [import-error]']
2021
"""
2122
output = """
22-
File "directives_deprecated.py", line 15, in <module>: Can't find module '_directives_deprecated_library'. [import-error]
23-
File "directives_deprecated.py", line 16, in <module>: Can't find module '_directives_deprecated_library'. [import-error]
24-
File "directives_deprecated.py", line 18, in <module>: typing_extensions.deprecated not supported yet [not-supported-yet]
25-
File "directives_deprecated.py", line 66, in <module>: typing.override not supported yet [not-supported-yet]
23+
File "directives_deprecated.py", line 10, in <module>: typing.override not supported yet [not-supported-yet]
24+
File "directives_deprecated.py", line 11, in <module>: typing_extensions.deprecated not supported yet [not-supported-yet]
25+
File "directives_deprecated.py", line 18, in <module>: Can't find module '_directives_deprecated_library'. [import-error]
26+
File "directives_deprecated.py", line 19, in <module>: Can't find module '_directives_deprecated_library'. [import-error]
2627
"""
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
version = "pytype 2024.04.11"
2-
test_duration = 30.0
2+
test_duration = 34.1

conformance/results/results.html

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,16 +159,16 @@ <h3>Python Type System Conformance Test Results</h3>
159159
<div class="table_container"><table><tbody>
160160
<tr><th class="col1">&nbsp;</th>
161161
<th class='tc-header'><div class='tc-name'>mypy 1.11.0</div>
162-
<div class='tc-time'>1.4sec</div>
162+
<div class='tc-time'>1.2sec</div>
163163
</th>
164164
<th class='tc-header'><div class='tc-name'>pyright 1.1.373</div>
165-
<div class='tc-time'>1.2sec</div>
165+
<div class='tc-time'>1.4sec</div>
166166
</th>
167167
<th class='tc-header'><div class='tc-name'>pyre 0.9.22</div>
168-
<div class='tc-time'>1.8sec</div>
168+
<div class='tc-time'>2.6sec</div>
169169
</th>
170170
<th class='tc-header'><div class='tc-name'>pytype 2024.04.11</div>
171-
<div class='tc-time'>30.0sec</div>
171+
<div class='tc-time'>34.1sec</div>
172172
</th>
173173
</tr>
174174
<tr><th class="column" colspan="5">
@@ -987,7 +987,7 @@ <h3>Python Type System Conformance Test Results</h3>
987987
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;directives_reveal_type</th>
988988
<th class="column col2 conformant">Pass</th>
989989
<th class="column col2 conformant">Pass</th>
990-
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>"</p><p>Produces errors rather than warnings on `reveal_type`.</p></span></div></th>
990+
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Produces errors rather than warnings on `reveal_type`.</p></span></div></th>
991991
<th class="column col2 partially-conformant"><div class="hover-text">Partial<span class="tooltip-text" id="bottom"><p>Does not reject call to reveal_type with zero arguments.</p><p>Does not reject call to reveal_type with too many arguments.</p></span></div></th>
992992
</tr>
993993
<tr><th class="column col1">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;directives_type_checking</th>

conformance/tests/_directives_deprecated_library.py

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,42 +3,49 @@
33
"""
44

55
from typing import Self, overload
6-
76
from typing_extensions import deprecated
87

98

109
@deprecated("Use Spam instead")
11-
class Ham: ...
10+
class Ham:
11+
...
1212

1313

14-
@deprecated("It is pining for the fiords")
15-
def norwegian_blue(x: int) -> int: ...
14+
@deprecated("It is pining for the fjords")
15+
def norwegian_blue(x: int) -> int:
16+
...
1617

1718

1819
@overload
1920
@deprecated("Only str will be allowed")
20-
def foo(x: int) -> str: ...
21+
def foo(x: int) -> str:
22+
...
2123

2224

2325
@overload
24-
def foo(x: str) -> str: ...
26+
def foo(x: str) -> str:
27+
...
2528

2629

27-
def foo(x: int | str) -> str: ...
30+
def foo(x: int | str) -> str:
31+
...
2832

2933

3034
class Spam:
31-
3235
@deprecated("There is enough spam in the world")
33-
def __add__(self, other: object) -> Self: ...
36+
def __add__(self, other: object) -> Self:
37+
...
3438

3539
@property
3640
@deprecated("All spam will be equally greasy")
37-
def greasy(self) -> float: ...
41+
def greasy(self) -> float:
42+
...
3843

3944
@property
40-
def shape(self) -> str: ...
45+
def shape(self) -> str:
46+
...
4147

4248
@shape.setter
4349
@deprecated("Shapes are becoming immutable")
44-
def shape(self, value: str) -> None: ...
50+
def shape(self, value: str) -> None:
51+
...

0 commit comments

Comments
 (0)