Skip to content

Commit

Permalink
Adding int to enum, to allow equality between int and enum
Browse files Browse the repository at this point in the history
Closes #GSK-2032
  • Loading branch information
Hartorn committed Oct 31, 2023
1 parent 09675ed commit 949c1a8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
9 changes: 5 additions & 4 deletions giskard/ml_worker/testing/utils.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from typing import Optional

import numbers
from enum import Enum
from functools import wraps
import numbers
from typing import Optional

from giskard.datasets.base import Dataset
from giskard.core.core import SupportedModelTypes
from giskard.datasets.base import Dataset


class Direction(Enum):
class Direction(int, Enum):
Invariant = 0
Increasing = 1
Decreasing = -1
Expand Down
9 changes: 6 additions & 3 deletions tests/communications/test_listener_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@

from giskard.ml_worker import websocket
from giskard.ml_worker.exceptions.IllegalArgumentError import IllegalArgumentError
from giskard.ml_worker.websocket.listener import extract_debug_info, function_argument_to_ws, parse_function_arguments
from giskard.ml_worker.websocket.listener import (
extract_debug_info,
function_argument_to_ws,
parse_function_arguments,
)

TEST_PROJECT_KEY = "123"
TEST_MODEL_ID = "231"
Expand Down Expand Up @@ -30,7 +34,6 @@ def test_extract_debug_info():


def test_function_argument_to_ws():

# Domain classes creation should be tested somewhere else, do not test them.
# "dataset": Dataset,
# "model": BaseModel,
Expand Down Expand Up @@ -76,4 +79,4 @@ def test_parse_function_arguments():
assert "int" in kwargs.keys() and kwargs["int"] == TEST_FUNC_ARGUMENT_INT
assert "str" in kwargs.keys() and kwargs["str"] == TEST_FUNC_ARGUMENT_STR
assert "bool" in kwargs.keys() and kwargs["bool"] == TEST_FUNC_ARGUMENT_BOOL
assert "bool1" in kwargs.keys() and kwargs["bool1"] == TEST_FUNC_ARGUMENT_BOOL
assert "kwargs" in kwargs.keys() and kwargs["kwargs"]["bool1"] == TEST_FUNC_ARGUMENT_BOOL

0 comments on commit 949c1a8

Please sign in to comment.