import unittest
from modelverse_state.main import ModelverseState

class TestCreateDict(unittest.TestCase):
    def setUp(self):
        self.mvs = ModelverseState()

    def test_create_dict_simple(self):
        id1 = self.mvs.create_node()
        id2 = self.mvs.create_node()
        assert id1 != None
        assert id2 != None

        n = self.mvs.create_dict(id1, "abc", id2)
        assert n == None

        v = self.mvs.read_dict(id1, "abc")
        assert v == id2

    def test_create_dict_no_source(self):
        id1 = 100000
        id2 = self.mvs.create_node()
        assert id2 != None

        n = self.mvs.create_dict(id1, "abc", id2)
        assert n == None

        v = self.mvs.read_dict(id1, "abc")
        assert v == None

    def test_create_dict_no_target(self):
        id2 = 100000
        id1 = self.mvs.create_node()
        assert id1 != None

        n = self.mvs.create_dict(id1, "abc", id2)
        assert n == None

        v = self.mvs.read_dict(id1, "abc")
        assert v == None
