Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
beat.editor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
beat
beat.editor
Commits
71baf4b3
Commit
71baf4b3
authored
6 years ago
by
Flavio TARSETTI
Committed by
Flavio TARSETTI
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[test] adding tests for reusable component description
parent
722ea169
No related branches found
No related tags found
1 merge request
!55
Reusable widget short description
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
beat/editor/test/test_editors.py
+29
-0
29 additions, 0 deletions
beat/editor/test/test_editors.py
with
29 additions
and
0 deletions
beat/editor/test/test_editors.py
+
29
−
0
View file @
71baf4b3
...
@@ -33,6 +33,7 @@ from PyQt5.QtWidgets import QVBoxLayout
...
@@ -33,6 +33,7 @@ from PyQt5.QtWidgets import QVBoxLayout
from
..widgets.editor
import
AbstractAssetEditor
from
..widgets.editor
import
AbstractAssetEditor
from
..widgets.field
import
FieldWidget
from
..widgets.field
import
FieldWidget
from
..widgets.description
import
DescriptionWidget
class
MockAssetEditor
(
AbstractAssetEditor
):
class
MockAssetEditor
(
AbstractAssetEditor
):
...
@@ -76,6 +77,25 @@ class MockAssetEditor(AbstractAssetEditor):
...
@@ -76,6 +77,25 @@ class MockAssetEditor(AbstractAssetEditor):
return
json_data
return
json_data
def
set_description
(
self
,
desc
):
"""
Sets the text description of the asset
"""
description
=
DescriptionWidget
()
description
.
short_description
=
desc
self
.
layout
().
addWidget
(
description
)
def
get_description
(
self
):
"""
Returns the text description of the asset
"""
description_list
=
self
.
findChildren
(
DescriptionWidget
)
text_data
=
None
description
=
description_list
[
0
]
text_data
=
description
.
short_description
return
text_data
@pytest.fixture
()
@pytest.fixture
()
def
dataformat_model
():
def
dataformat_model
():
...
@@ -121,3 +141,12 @@ class TestMockEditor:
...
@@ -121,3 +141,12 @@ class TestMockEditor:
field
.
format_type
=
"
float64
"
field
.
format_type
=
"
float64
"
assert
widget
.
dump_json
()
==
{
"
value32
"
:
"
float32
"
,
"
value64
"
:
"
float64
"
}
assert
widget
.
dump_json
()
==
{
"
value32
"
:
"
float32
"
,
"
value64
"
:
"
float64
"
}
def
test_description_set_and_get
(
self
,
qtbot
,
dataformat_model
):
text_reference
=
"
short descr1iption of a beat object
"
widget
=
MockAssetEditor
()
widget
.
set_dataformat_model
(
dataformat_model
)
widget
.
set_description
(
text_reference
)
assert
widget
.
get_description
()
==
text_reference
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment