Skip to content

Commit

Permalink
Merge pull request #17 from FAIRChemistry/tests
Browse files Browse the repository at this point in the history
Tests
  • Loading branch information
haeussma authored Feb 6, 2024
2 parents 0909d30 + 67fbb75 commit c317f89
Show file tree
Hide file tree
Showing 9 changed files with 1,006 additions and 1,207 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Tests

on: push

jobs:
build:

runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10", "3.11"]

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install poetry
poetry install --with dev
- name: Run tests with pytest
run: |
poetry run pytest
155 changes: 0 additions & 155 deletions MTPHandler/core/abstractspecies.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,158 +65,3 @@ def get_vessel_id_reference(cls, value):
raise TypeError(
f"Expected types [Vessel, str] got '{type(value).__name__}' instead."
)

@validator("vessel_id")
def get_vessel_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .vessel import Vessel

if isinstance(value, Vessel):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [Vessel, str] got '{type(value).__name__}' instead."
)

@validator("vessel_id")
def get_vessel_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .vessel import Vessel

if isinstance(value, Vessel):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [Vessel, str] got '{type(value).__name__}' instead."
)

@validator("vessel_id")
def get_vessel_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .vessel import Vessel

if isinstance(value, Vessel):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [Vessel, str] got '{type(value).__name__}' instead."
)

@validator("vessel_id")
def get_vessel_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .vessel import Vessel

if isinstance(value, Vessel):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [Vessel, str] got '{type(value).__name__}' instead."
)

@validator("vessel_id")
def get_vessel_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .vessel import Vessel

if isinstance(value, Vessel):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [Vessel, str] got '{type(value).__name__}' instead."
)

@validator("vessel_id")
def get_vessel_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .vessel import Vessel

if isinstance(value, Vessel):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [Vessel, str] got '{type(value).__name__}' instead."
)

@validator("vessel_id")
def get_vessel_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .vessel import Vessel

if isinstance(value, Vessel):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [Vessel, str] got '{type(value).__name__}' instead."
)

@validator("vessel_id")
def get_vessel_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .vessel import Vessel

if isinstance(value, Vessel):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [Vessel, str] got '{type(value).__name__}' instead."
)

@validator("vessel_id")
def get_vessel_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .vessel import Vessel

if isinstance(value, Vessel):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [Vessel, str] got '{type(value).__name__}' instead."
)

@validator("vessel_id")
def get_vessel_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .vessel import Vessel

if isinstance(value, Vessel):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [Vessel, str] got '{type(value).__name__}' instead."
)

@validator("vessel_id")
def get_vessel_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""

from .vessel import Vessel

if isinstance(value, Vessel):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [Vessel, str] got '{type(value).__name__}' instead."
)
106 changes: 0 additions & 106 deletions MTPHandler/core/blankstate.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,109 +43,3 @@ def get_species_id_reference(cls, value):
f"Expected types [AbstractSpecies, str] got '{type(value).__name__}'"
" instead."
)

@validator("species_id")
def get_species_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .abstractspecies import AbstractSpecies

if isinstance(value, AbstractSpecies):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [AbstractSpecies, str] got '{type(value).__name__}'"
" instead."
)

@validator("species_id")
def get_species_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .abstractspecies import AbstractSpecies

if isinstance(value, AbstractSpecies):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [AbstractSpecies, str] got '{type(value).__name__}'"
" instead."
)

@validator("species_id")
def get_species_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .abstractspecies import AbstractSpecies

if isinstance(value, AbstractSpecies):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [AbstractSpecies, str] got '{type(value).__name__}'"
" instead."
)

@validator("species_id")
def get_species_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .abstractspecies import AbstractSpecies

if isinstance(value, AbstractSpecies):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [AbstractSpecies, str] got '{type(value).__name__}'"
" instead."
)

@validator("species_id")
def get_species_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .abstractspecies import AbstractSpecies

if isinstance(value, AbstractSpecies):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [AbstractSpecies, str] got '{type(value).__name__}'"
" instead."
)

@validator("species_id")
def get_species_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""
from .abstractspecies import AbstractSpecies

if isinstance(value, AbstractSpecies):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [AbstractSpecies, str] got '{type(value).__name__}'"
" instead."
)

@validator("species_id")
def get_species_id_reference(cls, value):
"""Extracts the ID from a given object to create a reference"""

from .abstractspecies import AbstractSpecies

if isinstance(value, AbstractSpecies):
return value.id
elif isinstance(value, str):
return value
else:
raise TypeError(
f"Expected types [AbstractSpecies, str] got '{type(value).__name__}'"
" instead."
)
Loading

0 comments on commit c317f89

Please sign in to comment.