35 lines
1.0 KiB
Python
35 lines
1.0 KiB
Python
import sys
|
|
import os
|
|
import unittest
|
|
|
|
# Add the project root directory to the Python path to resolve the ModuleNotFoundError.
|
|
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
|
|
|
|
from pytrace.core.node_base import TraceNode
|
|
|
|
class TestNodeA(TraceNode):
|
|
"""A dummy node for testing purposes."""
|
|
CATEGORY = "Test"
|
|
|
|
def process(self, **kwargs):
|
|
# A simple process method
|
|
return {'output': 1}
|
|
|
|
class NodeLogicTests(unittest.TestCase):
|
|
|
|
def test_node_creation(self):
|
|
"""Tests that a basic node can be instantiated."""
|
|
node = TestNodeA(uid="test_01", name="Test Node")
|
|
self.assertIsInstance(node, TraceNode)
|
|
self.assertEqual(node.uid, "test_01")
|
|
|
|
def test_node_process(self):
|
|
"""Tests the dummy node's process method."""
|
|
node = TestNodeA(uid="test_02", name="Test Node 2")
|
|
result = node.process()
|
|
self.assertIn('output', result)
|
|
self.assertEqual(result['output'], 1)
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|