Commit 94ea8d99 authored by Maxime Perrotin's avatar Maxime Perrotin
Browse files

Prepare complex test case

parent 1c512c3e
...@@ -11,34 +11,34 @@ Use py.test-2.7 to run these tests, and make sure you have installed pytest-qt ...@@ -11,34 +11,34 @@ 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 test_true(qtbot): def common(asn1File, typeName, defValue):
''' Test with a single boolean type ''' ''' Set up test case: create asn1 editor and fill with default value '''
expected = 'TRUE' s = editor.SingleValueEditor(asn1File, paramsAndTypes={'param': typeName})
typename = "Ahah" widget = s.setupEdit(typeName, defValue=defValue)['editor']
s = editor.SingleValueEditor('data/dv2.asn',
paramsAndTypes={'param': typename})
widget = s.setupEdit(typename, defValue=expected)['editor']
widget.getVariable(dest=widget.asn1Instance) widget.getVariable(dest=widget.asn1Instance)
result = widget.asn1Instance.GSER() return widget.asn1Instance.GSER()
print result
assert result == expected def test_true(qtbot):
''' Most basic test: single boolean type '''
typeName = "Ahah"
defValue = 'TRUE'
result = common('data/dv2.asn', typeName, defValue)
assert result == defValue
def test_false(qtbot): def test_false(qtbot):
''' Test with a single boolean type ''' ''' Test with a single boolean type '''
expected = 'FALSE' typeName = "Ahah"
typename = "Ahah" defValue = 'FALSE'
s = editor.SingleValueEditor('data/dv2.asn', result = common('data/dv2.asn', typeName, defValue)
paramsAndTypes={'param': typename}) assert result == defValue
widget = s.setupEdit(typename, defValue=expected)['editor']
widget.getVariable(dest=widget.asn1Instance) def test_alltypes(qtbot):
result = widget.asn1Instance.GSER() ''' More complete test with various types/editors '''
print result typeName = "Type-SingleInt"
assert result == expected defValue = '42'
result = common('data/dv1.asn', typeName, defValue)
assert result == defValue
def test_2():
''' Test '''
assert True
if __name__ == '__main__': if __name__ == '__main__':
print('You must run py.test-2.7 to execute this test script') print('You must run py.test-2.7 to execute this test script')
......
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