Skip to content

Commit

Permalink
TestItem: convert to dataclass, remove class vars (#15286)
Browse files Browse the repository at this point in the history
`TestItem` has instance attributes, so it doesn't need the class vars.
  • Loading branch information
ikonst committed May 24, 2023
1 parent 9270819 commit b8dd40e
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions mypy/test/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import sys
import tempfile
from abc import abstractmethod
from dataclasses import dataclass
from typing import Any, Iterator, NamedTuple, Pattern, Union
from typing_extensions import Final, TypeAlias as _TypeAlias

Expand Down Expand Up @@ -414,6 +415,7 @@ def module_from_path(path: str) -> str:
return module


@dataclass
class TestItem:
"""Parsed test caseitem.
Expand All @@ -422,20 +424,10 @@ class TestItem:
.. data ..
"""

id = ""
arg: str | None = ""

# Text data, array of 8-bit strings
id: str
arg: str | None
data: list[str]

file = ""
line = 0 # Line number in file

def __init__(self, id: str, arg: str | None, data: list[str], line: int) -> None:
self.id = id
self.arg = arg
self.data = data
self.line = line
line: int


def parse_test_data(raw_data: str, name: str) -> list[TestItem]:
Expand Down

0 comments on commit b8dd40e

Please sign in to comment.