def setup_method(self, method): self.element = ValueElement("ValueId", "ValueName", key="ValueKey")
def setup_method(self, method): self.element = ValueElement("ValueId", "ValueName")
class TestValueElement(object): def setup_method(self, method): self.element = ValueElement("ValueId", "ValueName", key="ValueKey") def test_insertVariableByKey(self): variableDict = {'SomeValue':'AHHH!', 'ValueKey':'First', 'ValueId':'Second', 'ValueName':'Third', 'SomeOtherValue':[1, 2, 3, 4]} self.element.insertVariables(variableDict) assert self.element.value() == 'First' assert self.element.exportVariables() == {'ValueKey':'First'} def test_insertVariableById(self): variableDict = {'SomeValue':'AHHH!', 'ValueId':'Second', 'ValueName':'Third', 'SomeOtherValue':[1, 2, 3, 4]} self.element.insertVariables(variableDict) assert self.element.value() == 'Second' assert self.element.exportVariables() == {'ValueKey':'Second'} def test_insertVariableByName(self): variableDict = {'SomeValue':'AHHH!', 'ValueName':'Third', 'SomeOtherValue':[1, 2, 3, 4]} self.element.insertVariables(variableDict) assert self.element.value() == 'Third' def test_insertVariableListByName(self): variableDict = {'TestValues':'asfjsfadlkfsdj', 'ValueName':["Red", "Green", "Blue"], 'SomeOtherValue':[5, 6, 7, 8]} self.element.insertVariables(variableDict) assert self.element.value() == 'Red' assert self.element.exportVariables() == {'ValueKey':'Red'} self.element.insertVariables(variableDict) assert self.element.value() == 'Green' assert self.element.exportVariables() == {'ValueKey':'Green'} self.element.insertVariables(variableDict) assert self.element.value() == 'Blue' assert self.element.exportVariables() == {'ValueKey':'Blue'} def test_value(self): assert not self.element.value() self.element.setValue("I set the value :)") assert self.element.value() == 'I set the value :)'
class TestValueElement(object): def setup_method(self, method): self.element = ValueElement("ValueId", "ValueName") def test_insertVariableByKey(self): variableDict = { 'SomeValue': 'AHHH!', 'ValueId': 'Second', 'ValueName': 'Third', 'SomeOtherValue': [1, 2, 3, 4] } self.element.insertVariables(variableDict) assert self.element.value() == 'Second' assert self.element.exportVariables() == {'ValueName': 'Second'} def test_insertVariableById(self): variableDict = { 'SomeValue': 'AHHH!', 'ValueId': 'Second', 'ValueName': 'Third', 'SomeOtherValue': [1, 2, 3, 4] } self.element.insertVariables(variableDict) assert self.element.value() == 'Second' assert self.element.exportVariables() == {'ValueName': 'Second'} def test_insertVariableByName(self): variableDict = { 'SomeValue': 'AHHH!', 'ValueName': 'Third', 'SomeOtherValue': [1, 2, 3, 4] } self.element.insertVariables(variableDict) assert self.element.value() == 'Third' def test_insertVariableListByName(self): variableDict = { 'TestValues': 'asfjsfadlkfsdj', 'ValueName': ["Red", "Green", "Blue"], 'SomeOtherValue': [5, 6, 7, 8] } self.element.insertVariables(variableDict) assert self.element.value() == 'Red' assert self.element.exportVariables() == {'ValueName': 'Red'} self.element.insertVariables(variableDict) assert self.element.value() == 'Green' assert self.element.exportVariables() == {'ValueName': 'Green'} self.element.insertVariables(variableDict) assert self.element.value() == 'Blue' assert self.element.exportVariables() == {'ValueName': 'Blue'} def test_value(self): assert not self.element.value() self.element.setValue("I set the value :)") assert self.element.value() == 'I set the value :)'