Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong dataclass configuration setup - now fixed #31

Merged
merged 1 commit into from
Nov 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions pycgmes/utils/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
from .profile import BaseProfile


@dataclass
# Config will be inherited.
@dataclass(config=cgmes_resource_config)
class Base:
"""
Base Class for resources.
"""

# Will be inherited in subclasses.
model_config = cgmes_resource_config

@cached_property
def possible_profiles(self) -> set[BaseProfile]:
raise NotImplementedError("Method not implemented because not relevant in Base.")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

[tool.poetry]
name = "pycgmes"
version = "2.0.0"
version = "2.0.1"
description = "Python dataclasses for CGMES 3.0.0"
authors = ["pycgmes <[email protected]>"]
readme = "README.md"
Expand Down
5 changes: 5 additions & 0 deletions tests/test_bay.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,8 @@ def test_param_validation(self):
# mRID is not allowed to be None
with pytest.raises(ValidationError):
Bay(mRID=None)

def test_extra_filed_forbidden(self):
# Extra fields are not allowed
with pytest.raises(ValidationError):
Bay(somefield="should not exist")
Loading