Category : testing

Assume I have the following classes: @dataclass class Image: array: np.ndarray @dataclass class Label: array: np.ndarray @dataclass class Sample: image: Image label: Label with the following factory_boy factories: class ImageFactory(factory.Factory): class Meta: model = Image class Params: shape = (64, 64) array = factory.LazyAttribute(lambda o: np.random.random(o.shape)) class LabelFactory(factory.Factory): class Meta: model = Label class Params: ..

Read more

I am working on a problem where I need to reconstruct an image in a Pix2Pix-like manner. The data has some attributes what would make a Transformer/Perceiver IO favourable in my opinion (e.g. the y axis contains information about the location, but is not necessarily neighboured to the row above, hence Convolutions assume a structure ..

Read more

I can’t seem to figure out why my unittest is not running. enter image description here I am trying to test the methods in calculator class: class Calculator(): def __init__(self): pass def is_peak(self, start_time: str): time = start_time.split(‘:’) # Extracts the hour character from the string hour = time[0] int_hour = int(hour) if 6 <= ..

Read more

I try to create a test case in pytest. I want to use parameterized fixtures to get parameters from the @pytest.mark.parametrize decorator and create more types of tests. My code looks right now: @pytest.mark.parametrize( "a", ["1", "2"], ids=["a:1", "a:2"] ) @pytest.mark.parametrize( # type: ignore "fixture_a", [{"b": 1}], ids=["b:1"], indirect=["fixture_a"], ) def test_postgres_basic(fixture_a, a): … What ..

Read more