Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
asn1-value-editor
Commits
94ea8d99
Commit
94ea8d99
authored
Jul 16, 2016
by
Maxime Perrotin
Browse files
Prepare complex test case
parent
1c512c3e
Changes
1
Hide whitespace changes
Inline
Side-by-side
test/pytest/test_standalone.py
View file @
94ea8d99
...
...
@@ -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'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment