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
pip install --user pytest-qt
'''
def test_true(qtbot):
''' Test with a single boolean type '''
expected = 'TRUE'
typename = "Ahah"
s = editor.SingleValueEditor('data/dv2.asn',
paramsAndTypes={'param': typename})
widget = s.setupEdit(typename, defValue=expected)['editor']
def common(asn1File, typeName, defValue):
''' Set up test case: create asn1 editor and fill with default value '''
s = editor.SingleValueEditor(asn1File, paramsAndTypes={'param': typeName})
widget = s.setupEdit(typeName, defValue=defValue)['editor']
widget.getVariable(dest=widget.asn1Instance)
result = widget.asn1Instance.GSER()
print result
assert result == expected
return widget.asn1Instance.GSER()
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):
''' Test with a single boolean type '''
expected = 'FALSE'
typename = "Ahah"
s = editor.SingleValueEditor('data/dv2.asn',
paramsAndTypes={'param': typename})
widget = s.setupEdit(typename, defValue=expected)['editor']
widget.getVariable(dest=widget.asn1Instance)
result = widget.asn1Instance.GSER()
print result
assert result == expected
typeName = "Ahah"
defValue = 'FALSE'
result = common('data/dv2.asn', typeName, defValue)
assert result == defValue
def test_alltypes(qtbot):
''' More complete test with various types/editors '''
typeName = "Type-SingleInt"
defValue = '42'
result = common('data/dv1.asn', typeName, defValue)
assert result == defValue
def test_2():
''' Test '''
assert True
if __name__ == '__main__':
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