from scripttease.lib.contexts import * class TestContext(object): def test_add(self): c = Context() v = c.add("testing", True) assert isinstance(v, Variable) def test_append(self): c = Context() v = Variable("testing", True) c.append(v) assert len(c.variables.keys()) == 1 def test_getattr(self): c = Context() c.add("testing", True) assert c.testing.value is True def test_mapping(self): c = Context() c.add("testing", True) assert 'testing' in c.mapping() class TestVariable(object): def test_getattr(self): tags = ["this", "is", "a", "test"] v = Variable("testing", True, tags=tags) assert v.tags == tags def test_str(self): v = Variable("testing", True) assert str(v) == "True"