pytest-revealtype-injector 0.1.0__py3-none-any.whl → 0.1.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  """Pytest plugin for replacing reveal_type() calls inside test functions with static and runtime type checking result comparison, for confirming type annotation validity.""" # noqa: E501
2
2
 
3
- __version__ = "0.1.0"
3
+ __version__ = "0.1.1"
@@ -168,8 +168,25 @@ class _MypyAdapter(TypeCheckerAdapter):
168
168
  # Try stripping those character and pray we get something
169
169
  # usable for evaluation
170
170
  expression = m["type"].translate({ord(c): None for c in "*?="})
171
- # Unlike pyright, mypy output doesn't contain variable name
172
- cls.typechecker_result[pos] = VarType(None, ForwardRef(expression))
171
+ try:
172
+ # Unlike pyright, mypy output doesn't contain variable name
173
+ cls.typechecker_result[pos] = VarType(None, ForwardRef(expression))
174
+ except SyntaxError as e:
175
+ if (
176
+ m := re.fullmatch(r"<Deleted '(?P<var>.+)'>", expression)
177
+ ) is not None:
178
+ raise TypeCheckerError(
179
+ "{} does not support reusing deleted variable '{}'".format(
180
+ cls.id, m["var"]
181
+ ),
182
+ diag["file"],
183
+ diag["line"],
184
+ ) from e
185
+ raise TypeCheckerError(
186
+ f"Cannot parse type expression '{expression}'",
187
+ diag["file"],
188
+ diag["line"],
189
+ ) from e
173
190
 
174
191
  @classmethod
175
192
  def create_collector(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pytest-revealtype-injector
3
- Version: 0.1.0
3
+ Version: 0.1.1
4
4
  Summary: Pytest plugin for replacing reveal_type() calls inside test functions with static and runtime type checking result comparison, for confirming type annotation validity.
5
5
  Project-URL: homepage, https://github.com/abelcheung/pytest-revealtype-injector
6
6
  Author-email: Abel Cheung <abelcheung@gmail.com>
@@ -1,15 +1,14 @@
1
- pytest_revealtype_injector/__init__.py,sha256=TynSjgz0Fsu8af4PjJ57iiAYGsOta7YIhLfUUj6Q3rQ,211
1
+ pytest_revealtype_injector/__init__.py,sha256=-sBG0VW8hqWI1JUSqzgJ6M0nptG5OWWQw9dzjnVpRQ8,211
2
2
  pytest_revealtype_injector/hooks.py,sha256=5V2r19I47xQtCDd8ZAzXlqt3nYaBZ4CaMAyGP6w_Y0k,2414
3
3
  pytest_revealtype_injector/main.py,sha256=dBlXcGc2NBcEHp0YX75Bp4Q7KY-t1oxlmPQS6o08U24,4490
4
4
  pytest_revealtype_injector/models.py,sha256=hWo9Oz2ausmht-QpfMTTiCtdE3980IA2KEuch7mo_jk,3158
5
5
  pytest_revealtype_injector/plugin.py,sha256=fkI6yF0dFVba0jEikIrsRp1NUQd2ohWLq4x2lSvFyH0,211
6
6
  pytest_revealtype_injector/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  pytest_revealtype_injector/adapter/__init__.py,sha256=wQg3Ply0Xrfe9US_lzgqRgKFE89ZBvDFti6_77X_NKk,339
8
- pytest_revealtype_injector/adapter/mypy_.py,sha256=UBx0Oj61y8M_ZP0Gc1YY4rKC6MKKOwjJZ1olxQbm-tQ,7539
8
+ pytest_revealtype_injector/adapter/mypy_.py,sha256=qXZKppEwPYtCcRVBAvg8cLx2heI673w8cT9VftHNU_c,8237
9
9
  pytest_revealtype_injector/adapter/pyright_.py,sha256=SEibrnMa0AAa1M3S4BmwEQ7ZgwQEUttsFOi-GWCrisA,4105
10
- pytest_revealtype_injector-0.1.0.dist-info/METADATA,sha256=aRO_sbJWzI9NuFojH7viykdFWEeDwP099jw3mSDzs-s,3649
11
- pytest_revealtype_injector-0.1.0.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
12
- pytest_revealtype_injector-0.1.0.dist-info/entry_points.txt,sha256=UfOm7y3WQnOoGV1mgTMb42MI6iBRPIl88FJiAOnt6SY,74
13
- pytest_revealtype_injector-0.1.0.dist-info/licenses/COPYING,sha256=LSYUX8PcSMvHCkhM5oi07eOrSLV89qdEJ-FVZmbcpNE,355
14
- pytest_revealtype_injector-0.1.0.dist-info/licenses/COPYING.mit,sha256=IzYEFDIOECyuupg_B3O9FvgjnU9i4JtambpbleoYHdQ,1060
15
- pytest_revealtype_injector-0.1.0.dist-info/RECORD,,
10
+ pytest_revealtype_injector-0.1.1.dist-info/METADATA,sha256=ZNYRvvNfc1Hm5LAPyUvPcJWmqHqdFQxlQwviUovZJAE,3649
11
+ pytest_revealtype_injector-0.1.1.dist-info/WHEEL,sha256=C2FUgwZgiLbznR-k0b_5k3Ai_1aASOXDss3lzCUsUug,87
12
+ pytest_revealtype_injector-0.1.1.dist-info/entry_points.txt,sha256=UfOm7y3WQnOoGV1mgTMb42MI6iBRPIl88FJiAOnt6SY,74
13
+ pytest_revealtype_injector-0.1.1.dist-info/licenses/LICENSE,sha256=nLEPjqH24l4RByIq0dHIFhblIpcxpDrRX7sT3lBNoeM,1420
14
+ pytest_revealtype_injector-0.1.1.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
- Copyright (c) 2023-2024 Abel Cheung
1
+ Copyright (c) 2023-2025 Abel Cheung
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy
4
4
  of this software and associated documentation files (the "Software"), to deal
@@ -17,3 +17,13 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
17
  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
18
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
19
  SOFTWARE.
20
+
21
+
22
+ ---------------------
23
+
24
+ pytest-revealtype-injector is released under MIT license (see above).
25
+
26
+ Original source code comes from part of types-lxml project, which is released
27
+ under Apache-2.0 license. But as the sole author of all relevant source code, it
28
+ is at my own discretion to follow pytest license because this project is taking
29
+ form of a pytest plugin.
@@ -1,6 +0,0 @@
1
- pytest-revealtype-injector is released under MIT license (see COPYING.mit).
2
-
3
- Original source code comes from part of types-lxml project, which is
4
- release under Apache-2.0 license. But as the sole author of all source
5
- code inside this repository, it is at my own discretion to follow pytest
6
- license because this project is taking shape as a pytest plugin.