You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							37 lines
						
					
					
						
							860 B
						
					
					
				
			
		
		
	
	
							37 lines
						
					
					
						
							860 B
						
					
					
				| 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"
 | |
| 
 |