Skip to content

Commit

Permalink
Fixed metadata errors for pytest
Browse files Browse the repository at this point in the history
  • Loading branch information
Masara committed Oct 4, 2023
1 parent 10bed72 commit 89bb171
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 58 deletions.
12 changes: 6 additions & 6 deletions tests/data/test_package/__init__.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import _reexport_module_1 as reex_1
from _reexport_module_1 import ReexportClass
from _reexport_module_2 import reexported_function_2
from _reexport_module_3 import * # noqa: F403
from _reexport_module_4 import FourthReexportClass
from test_enums import _ReexportedEmptyEnum
from . import _reexport_module_1 as reex_1
from ._reexport_module_1 import ReexportClass
from ._reexport_module_2 import reexported_function_2
from ._reexport_module_3 import * # noqa: F403
from ._reexport_module_4 import FourthReexportClass
from .test_enums import _ReexportedEmptyEnum

__all__ = [ # noqa: F405
"reex_1",
Expand Down
6 changes: 3 additions & 3 deletions tests/data/test_package/test_enums.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from enum import Enum
from enum import Enum, IntEnum
from enum import Enum as _Enum

from .another_path.another_module import AnotherClass as _AcImportAlias


class TestEnum(Enum):
class EnumTest(Enum):
"""Enum Docstring.
Full Docstring Description
Expand All @@ -23,5 +23,5 @@ class _ReexportedEmptyEnum(_Enum):
"""Nothing's here."""


class AnotherTestEnum(_Enum, Enum):
class AnotherTestEnum(IntEnum):
ELEVEN = 11
6 changes: 3 additions & 3 deletions tests/data/test_package/test_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def _private_global_func() -> _AcImportAlias | AcDoubleAlias | ac_alias:
pass


class SomeClass(mathematics, AcDoubleAlias):
class SomeClass(AcDoubleAlias):
"""Summary of the description.
Full description
Expand All @@ -39,7 +39,7 @@ class SomeClass(mathematics, AcDoubleAlias):
_no_type_hint_private = 1

object_attr: _AcImportAlias
object_attr_2: AcDoubleAlias | mathematics
object_attr_2: AcDoubleAlias

tuple_attr_1: tuple
tuple_attr_2: tuple[str | int]
Expand Down Expand Up @@ -101,7 +101,7 @@ def no_return_1(self):
def no_return_2(self) -> None:
pass

class NestedClass(_AcImportAlias, mypy):
class NestedClass(_AcImportAlias):
def nested_class_function(self, param_1: int) -> set[bool | None]:
pass

Expand Down
87 changes: 41 additions & 46 deletions tests/safeds_stubgen/api_analyzer/test__get_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ def _assert_list_of_dicts(list_1: list[dict], list_2: list[dict]) -> None:
"qualified_name": "enum.Enum",
"alias": None,
},
{
"qualified_name": "enum.IntEnum",
"alias": None,
},
{
"qualified_name": "enum.Enum",
"alias": "_Enum",
Expand All @@ -206,7 +210,7 @@ def _assert_list_of_dicts(list_1: list[dict], list_2: list[dict]) -> None:
"classes": [],
"functions": [],
"enums": [
"test_package/test_enums/TestEnum",
"test_package/test_enums/EnumTest",
"test_package/test_enums/_ReexportedEmptyEnum",
"test_package/test_enums/AnotherTestEnum",
],
Expand All @@ -222,7 +226,7 @@ def _assert_list_of_dicts(list_1: list[dict], list_2: list[dict]) -> None:
"alias": None,
},
{
"qualified_name": "_reexport_module_1",
"qualified_name": "._reexport_module_1",
"alias": "reex_1",
},
{
Expand Down Expand Up @@ -358,6 +362,10 @@ def test_modules(
"qualified_name": "enum.Enum",
"alias": "_Enum",
},
{
"qualified_name": "enum.IntEnum",
"alias": None,
},
{
"qualified_name": "another_path.another_module.AnotherClass",
"alias": "_AcImportAlias",
Expand All @@ -372,7 +380,7 @@ def test_modules(
"alias": None,
},
{
"qualified_name": "_reexport_module_1",
"qualified_name": "._reexport_module_1",
"alias": "reex_1",
},
{
Expand Down Expand Up @@ -455,7 +463,6 @@ def test_imports(
"id": "test_package/test_module/SomeClass",
"name": "SomeClass",
"superclasses": [
"math",
"tests.data.test_package.test_module.AcDoubleAlias",
],
"is_public": True,
Expand Down Expand Up @@ -522,7 +529,6 @@ def test_imports(
"name": "NestedClass",
"superclasses": [
"tests.data.test_package.another_path.another_module.AnotherClass",
"mypy",
],
"is_public": True,
"reexported_by": [],
Expand Down Expand Up @@ -962,17 +968,8 @@ def test_classes(
"is_public": True,
"is_static": True,
"type": {
"kind": "UnionType",
"types": [
{
"kind": "NamedType",
"name": "AnotherClass",
},
{
"kind": "NamedType",
"name": "mathematics",
},
],
"kind": "NamedType",
"name": "AnotherClass",
},
"docstring": {
"type": "",
Expand Down Expand Up @@ -1605,23 +1602,23 @@ def test_class_attributes(

# ############################## Enums ############################## #
enums_test_enums_testenum = {
"id": "test_package/test_enums/TestEnum",
"name": "TestEnum",
"id": "test_package/test_enums/EnumTest",
"name": "EnumTest",
"docstring": {
"description": "Enum Docstring.\n\nFull Docstring Description",
"full_docstring": "Enum Docstring.\n\nFull Docstring Description",
},
"instances": [
"test_package/test_enums/TestEnum/ONE",
"test_package/test_enums/TestEnum/TWO",
"test_package/test_enums/TestEnum/THREE",
"test_package/test_enums/TestEnum/FOUR",
"test_package/test_enums/TestEnum/FIVE",
"test_package/test_enums/TestEnum/SIX",
"test_package/test_enums/TestEnum/SEVEN",
"test_package/test_enums/TestEnum/EIGHT",
"test_package/test_enums/TestEnum/NINE",
"test_package/test_enums/TestEnum/TEN",
"test_package/test_enums/EnumTest/ONE",
"test_package/test_enums/EnumTest/TWO",
"test_package/test_enums/EnumTest/THREE",
"test_package/test_enums/EnumTest/FOUR",
"test_package/test_enums/EnumTest/FIVE",
"test_package/test_enums/EnumTest/SIX",
"test_package/test_enums/EnumTest/SEVEN",
"test_package/test_enums/EnumTest/EIGHT",
"test_package/test_enums/EnumTest/NINE",
"test_package/test_enums/EnumTest/TEN",
],
}

Expand Down Expand Up @@ -1652,7 +1649,7 @@ def test_class_attributes(
("enum_name", "expected_enum_data"),
[
(
"TestEnum",
"EnumTest",
enums_test_enums_testenum,
),
(
Expand All @@ -1665,7 +1662,7 @@ def test_class_attributes(
),
],
ids=[
"Enums: TestEnum",
"Enums: EnumTest",
"Enums: _ReexportedEmptyEnum",
"Enums: AnotherTestEnum",
],
Expand All @@ -1688,43 +1685,43 @@ def test_enums(
# ############################## Enum Instances ############################## #
enum_instances_test_enums_testenum = [
{
"id": "test_package/test_enums/TestEnum/ONE",
"id": "test_package/test_enums/EnumTest/ONE",
"name": "ONE",
},
{
"id": "test_package/test_enums/TestEnum/TWO",
"id": "test_package/test_enums/EnumTest/TWO",
"name": "TWO",
},
{
"id": "test_package/test_enums/TestEnum/THREE",
"id": "test_package/test_enums/EnumTest/THREE",
"name": "THREE",
},
{
"id": "test_package/test_enums/TestEnum/FOUR",
"id": "test_package/test_enums/EnumTest/FOUR",
"name": "FOUR",
},
{
"id": "test_package/test_enums/TestEnum/FIVE",
"id": "test_package/test_enums/EnumTest/FIVE",
"name": "FIVE",
},
{
"id": "test_package/test_enums/TestEnum/SIX",
"id": "test_package/test_enums/EnumTest/SIX",
"name": "SIX",
},
{
"id": "test_package/test_enums/TestEnum/SEVEN",
"id": "test_package/test_enums/EnumTest/SEVEN",
"name": "SEVEN",
},
{
"id": "test_package/test_enums/TestEnum/EIGHT",
"id": "test_package/test_enums/EnumTest/EIGHT",
"name": "EIGHT",
},
{
"id": "test_package/test_enums/TestEnum/NINE",
"id": "test_package/test_enums/EnumTest/NINE",
"name": "NINE",
},
{
"id": "test_package/test_enums/TestEnum/TEN",
"id": "test_package/test_enums/EnumTest/TEN",
"name": "TEN",
},
]
Expand All @@ -1743,7 +1740,7 @@ def test_enums(
("enum_name", "expected_enum_instance_data"),
[
(
"TestEnum",
"EnumTest",
enum_instances_test_enums_testenum,
),
(
Expand All @@ -1756,7 +1753,7 @@ def test_enums(
),
],
ids=[
"Enum Instances: TestEnum",
"Enum Instances: EnumTest",
"Enum Instances: _ReexportedEmptyEnum",
"Enum Instances: AnotherTestEnum",
],
Expand Down Expand Up @@ -1821,9 +1818,7 @@ def test_enum_instances(
"is_public": False,
"is_static": False,
"results": [],
"reexported_by": [
"test_package/__init__",
],
"reexported_by": [],
"parameters": [],
}]

Expand Down Expand Up @@ -1890,7 +1885,7 @@ def test_enum_instances(
),
],
ids=[
"Global Functions: TestEnum",
"Global Functions: EnumTest",
"Global Functions: _reexport_module_1",
"Global Functions: _reexport_module_2",
"Global Functions: _reexport_module_3",
Expand Down

0 comments on commit 89bb171

Please sign in to comment.