Skip to content

Commit

Permalink
add unit tests for model container
Browse files Browse the repository at this point in the history
  • Loading branch information
braingram committed Oct 20, 2023
1 parent 863d9c0 commit 8a56671
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions tests/test_abstract_model_container.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from collections.abc import Sequence

from stpipe.container import AbstractModelContainer


class BadContainer(Sequence):
def __getitem__(self):
pass

def __len__(self):
pass

def save(self, path, save_model_func):
pass

@staticmethod
def read_asn(filepath):
pass

def from_asn(self, asn_data, asn_file_path=None):
pass


class GoodContainer(BadContainer):
@property
def crds_observatory(self):
return ""


def test_good_container():
assert issubclass(GoodContainer, AbstractModelContainer)
gc = GoodContainer()
assert isinstance(gc, AbstractModelContainer)


def test_bad_container():
assert not issubclass(BadContainer, AbstractModelContainer)
bc = BadContainer()
assert not isinstance(bc, AbstractModelContainer)

0 comments on commit 8a56671

Please sign in to comment.