Skip to content
This repository has been archived by the owner on Sep 13, 2023. It is now read-only.

Commit

Permalink
add tests (#136)
Browse files Browse the repository at this point in the history
  • Loading branch information
mike0sv authored Dec 15, 2021
1 parent 751f1ab commit 3daf2ef
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tests/core/test_requirements.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import pytest
from pydantic import parse_obj_as

from mlem.contrib.sklearn import SklearnModel
from mlem.core.objects import ModelMeta
from mlem.core.requirements import (
CustomRequirement,
InstallableRequirement,
Expand Down Expand Up @@ -108,6 +111,17 @@ def test_resolve_unique_req():
assert reqs.installable[0] == req


def test_serialize_empty():
mt = SklearnModel(methods={}, model="")
obj = ModelMeta(model_type=mt)
payload = obj.dict()
obj2 = ModelMeta(model_type=mt)
obj2.requirements.__root__.append(InstallableRequirement(module="sklearn"))
assert obj.requirements.__root__ == []
new_obj = parse_obj_as(ModelMeta, payload)
assert new_obj == obj


# Copyright 2019 Zyfra
# Copyright 2021 Iterative
#
Expand Down

0 comments on commit 3daf2ef

Please sign in to comment.