Skip to content

Commit

Permalink
simple test script
Browse files Browse the repository at this point in the history
  • Loading branch information
sh-lee97 committed Aug 8, 2024
1 parent 2a6e047 commit 6a387ba
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions tests/test_data_configs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import pytest

from grafx.data import NodeConfigs


def test_node_configs_with_list():
config_list = ["custom1", "custom2"]
node_configs = NodeConfigs(config_list)

assert node_configs.num_node_types == 5
assert "custom1" in node_configs.node_types
assert "custom2" in node_configs.node_types
assert node_configs["custom1"] == {"inlets": ["main"], "outlets": ["main"]}
assert node_configs["custom2"] == {"inlets": ["main"], "outlets": ["main"]}

def test_node_configs_with_dict():
custom_config = {
"custom1": {"inlets": ["input1"], "outlets": ["output1"]},
"custom2": {"inlets": ["input2"], "outlets": ["output2"]},
}
node_configs = NodeConfigs(custom_config)

assert node_configs.num_node_types == 5
assert node_configs["custom1"] == {"inlets": ["input1"], "outlets": ["output1"]}
assert node_configs["custom2"] == {"inlets": ["input2"], "outlets": ["output2"]}

def test_invalid_config_type():
with pytest.raises(ValueError, match="Invalid type for config."):
NodeConfigs(123) # Invalid type

def test_node_configs_str():
config_list = ["custom1", "custom2"]
node_configs = NodeConfigs(config_list)
print(node_configs)

0 comments on commit 6a387ba

Please sign in to comment.