generated from MinBZK/python-project-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ee1719b
commit 5b525d0
Showing
10 changed files
with
120 additions
and
38 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
amt/migrations/versions/7f20f8562007_add_system_card_column.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""Add system_card_column | ||
Revision ID: 7f20f8562007 | ||
Revises: 1019b72fe63a | ||
Create Date: 2024-10-12 14:28:32.153283 | ||
""" | ||
|
||
from collections.abc import Sequence | ||
|
||
import sqlalchemy as sa | ||
from alembic import op | ||
|
||
# revision identifiers, used by Alembic. | ||
revision: str = "7f20f8562007" | ||
down_revision: str | None = "1019b72fe63a" | ||
branch_labels: str | Sequence[str] | None = None | ||
depends_on: str | Sequence[str] | None = None | ||
|
||
|
||
def upgrade() -> None: | ||
with op.batch_alter_table("project", schema=None) as batch_op: | ||
batch_op.add_column(sa.Column("system_card_json", sa.JSON(), nullable=True)) | ||
batch_op.drop_column("model_card") | ||
|
||
|
||
def downgrade() -> None: | ||
with op.batch_alter_table("project", schema=None) as batch_op: | ||
batch_op.add_column(sa.Column("model_card", sa.String(), nullable=True)) | ||
batch_op.drop_column("system_card_json") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,41 @@ | ||
from amt.models.project import Project | ||
from amt.schema.system_card import SystemCard | ||
|
||
|
||
def test_model_basic_project(): | ||
# given | ||
project = Project(name="Test Project", model_card="Test Card") | ||
project = Project(name="Test Project") | ||
|
||
# then | ||
assert project.name == "Test Project" | ||
|
||
|
||
def test_model_systemcard(): | ||
# given | ||
system_card = SystemCard(name="Test System Card") | ||
|
||
project = Project(name="Test Project", system_card=system_card) | ||
|
||
# then | ||
assert project.system_card is not None | ||
assert project.system_card.name == "Test System Card" | ||
|
||
# when | ||
project.system_card = None | ||
|
||
# then | ||
assert project.system_card is None | ||
|
||
|
||
def test_model_systemcard_full(): | ||
# given | ||
system_card = SystemCard(name="Test System Card", description="Test description", status="active") | ||
|
||
project = Project(name="Test Project") | ||
project.system_card = system_card | ||
|
||
# then | ||
assert project.system_card is not None | ||
assert project.system_card.name == "Test System Card" | ||
assert project.system_card.description == "Test description" | ||
assert project.system_card.status == "active" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters