Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
PythonFZ committed Mar 16, 2022
1 parent e37c590 commit 469491d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
17 changes: 17 additions & 0 deletions tests/unit_tests/zn/test_zn_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import znjson

from zntrack import zn
from zntrack.zn.dependencies import NodeAttribute, getdeps
from zntrack.zn.split_option import combine_values, split_value


Expand Down Expand Up @@ -112,3 +113,19 @@ def test_split_value_path():
new_path = combine_values(zntrack_data, params_data)
# TODO change order to be consistent with split_values
assert new_path == path


class ExampleNode:
module = "module"
node_name = "node01"
affected_files = ["a", "b"]


def test_getdeps():
assert getdeps(ExampleNode(), "my_attr") == NodeAttribute(
module="module",
cls="ExampleNode",
name="node01",
attribute="my_attr",
affected_files=["a", "b"],
)
4 changes: 2 additions & 2 deletions zntrack/zn/dependencies.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import dataclasses
import pathlib
from typing import TYPE_CHECKING, Set
from typing import TYPE_CHECKING, List

from zntrack.utils import utils

Expand All @@ -16,7 +16,7 @@ class NodeAttribute:
cls: str
name: str
attribute: str
affected_files: Set[pathlib.Path]
affected_files: List[pathlib.Path]


def getdeps(node: Node, attribute: str) -> NodeAttribute:
Expand Down

0 comments on commit 469491d

Please sign in to comment.