Commit 6d7758bf authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Stabilize test setup

parent 4c5c2d74
...@@ -11,28 +11,30 @@ Use py.test-2.7 to run these tests, and make sure you have installed pytest-qt ...@@ -11,28 +11,30 @@ Use py.test-2.7 to run these tests, and make sure you have installed pytest-qt
pip install --user pytest-qt pip install --user pytest-qt
''' '''
def common(editor, typeName, defValue): TEST = editor.SingleValueEditor('data/dv1.asn')
def common(typeName, defValue):
''' Set up test case: create asn1 editor and fill with default value ''' ''' Set up test case: create asn1 editor and fill with default value '''
widget = editor.setupEdit(typeName, defValue=defValue)['editor'] widget = TEST.setupEdit(typeName, defValue=defValue)['editor']
widget.getVariable(dest=widget.asn1Instance) widget.getVariable(dest=widget.asn1Instance)
return widget.asn1Instance.GSER() return widget.asn1Instance.GSER()
def test_manytypes(qtbot): def test_bool(qtbot):
''' Test all types defined in dv1.asn ''' ''' Test boolean values '''
s = editor.SingleValueEditor('data/dv1.asn')
typeName = "Type-SingleBool" typeName = "Type-SingleBool"
defValue = 'TRUE' defValue = 'TRUE'
result = common(s, typeName, defValue) result = common(typeName, defValue)
assert result == defValue assert result == defValue
defValue = 'FALSE' defValue = 'FALSE'
result = common(s, typeName, defValue) result = common(typeName, defValue)
assert result == defValue assert result == defValue
def test_int(qtbot):
''' Test integer value '''
typeName = "Type-SingleInt" typeName = "Type-SingleInt"
defValue = '42' defValue = '42'
result = common(s, typeName, defValue) result = common(typeName, defValue)
assert result == defValue assert result == defValue
if __name__ == '__main__': if __name__ == '__main__':
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment