Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SOHViewer
Manage
Activity
Members
Labels
Plan
Issues
14
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
5
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Software Public
PASSOFT
SOHViewer
Commits
a2c0a7da
Commit
a2c0a7da
authored
1 year ago
by
Lan Dam
Browse files
Options
Downloads
Patches
Plain Diff
modify unittest to work with list returned from get_index_from_data_picked
parent
b0722597
No related branches found
No related tags found
1 merge request
!165
Fix SOH info not show for bottom of Jerk/DPS and display all info lines for the case data point clicked matches more than one SOH lines.
Pipeline
#2925
passed with stage
in 2 minutes and 18 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/view/plotting/plotting_widget/test_plotting_widget_helper.py
+28
-22
28 additions, 22 deletions
...w/plotting/plotting_widget/test_plotting_widget_helper.py
with
28 additions
and
22 deletions
tests/view/plotting/plotting_widget/test_plotting_widget_helper.py
+
28
−
22
View file @
a2c0a7da
...
@@ -5,13 +5,13 @@ from sohstationviewer.view.plotting.plotting_widget.plotting_widget_helper \
...
@@ -5,13 +5,13 @@ from sohstationviewer.view.plotting.plotting_widget.plotting_widget_helper \
import
get_total_miny_maxy
,
get_index_from_data_picked
import
get_total_miny_maxy
,
get_index_from_data_picked
class
TestGetIndexFrom
Time
(
TestCase
):
class
TestGetIndexFrom
DataPicked
(
TestCase
):
@classmethod
@classmethod
def
setUpClass
(
cls
)
->
None
:
def
setUpClass
(
cls
)
->
None
:
cls
.
plotting_data
=
{
cls
.
plotting_data
=
{
'
CH1
'
:
{
'
CH1
'
:
{
'
times
'
:
[
np
.
array
([
1
,
2
,
3
,
4
,
5
,
6
])],
'
times
'
:
[
np
.
array
([
1
,
2
,
3
,
4
,
5
,
6
,
6
])],
'
data
'
:
[
np
.
array
([
1
,
1
,
0
,
1
,
1
,
0
])],
'
data
'
:
[
np
.
array
([
1
,
1
,
0
,
1
,
1
,
0
,
0
])],
'
chan_db_info
'
:
{
'
plotType
'
:
'
upDownDots
'
}
'
chan_db_info
'
:
{
'
plotType
'
:
'
upDownDots
'
}
},
},
'
CH2
'
:
{
'
CH2
'
:
{
...
@@ -27,45 +27,51 @@ class TestGetIndexFromTime(TestCase):
...
@@ -27,45 +27,51 @@ class TestGetIndexFromTime(TestCase):
}
}
def
test_time_not_included
(
self
):
def
test_time_not_included
(
self
):
real_idx
=
get_index_from_data_picked
(
real_idx
es
=
get_index_from_data_picked
(
self
.
plotting_data
[
'
CH1
'
],
7
,
1
)
self
.
plotting_data
[
'
CH1
'
],
7
,
1
)
self
.
assert
IsNone
(
real_idx
)
self
.
assert
Equal
(
len
(
real_idx
es
),
0
)
def
test_type_not_need_data_info
(
self
):
def
test_type_not_need_data_val
(
self
):
# CH3 has plotType='dotForTime' in ["multiColorDots", "dotForTime"])
# CH3 has plotType='dotForTime'
real_idx
=
get_index_from_data_picked
(
# which is in ["multiColorDots", "dotForTime"])
real_idxes
=
get_index_from_data_picked
(
self
.
plotting_data
[
'
CH3
'
],
4
,
4
)
self
.
plotting_data
[
'
CH3
'
],
4
,
4
)
self
.
assertEqual
(
real_idx
,
3
)
self
.
assertEqual
(
real_idx
es
.
tolist
(),
[
3
]
)
def
test_type_need_data_
info
(
self
):
def
test_type_need_data_
val
(
self
):
# CH2 has plotType='linesDots' not in ["multiColorDots", "dotForTime"])
# CH2 has plotType='linesDots' not in ["multiColorDots", "dotForTime"])
with
self
.
subTest
(
'
data not match time
'
):
with
self
.
subTest
(
'
data not match time
'
):
real_idx
=
get_index_from_data_picked
(
real_idx
es
=
get_index_from_data_picked
(
self
.
plotting_data
[
'
CH2
'
],
3
,
5
)
self
.
plotting_data
[
'
CH2
'
],
3
,
5
)
self
.
assert
IsNone
(
real_idx
)
self
.
assert
Equal
(
len
(
real_idx
es
),
0
)
with
self
.
subTest
(
'
data match 1st value
'
):
with
self
.
subTest
(
'
data match 1st value
'
):
real_idx
=
get_index_from_data_picked
(
real_idx
es
=
get_index_from_data_picked
(
self
.
plotting_data
[
'
CH2
'
],
3
,
7
)
self
.
plotting_data
[
'
CH2
'
],
3
,
7
)
self
.
assertEqual
(
real_idx
,
2
)
self
.
assertEqual
(
real_idx
es
.
tolist
(),
[
2
]
)
with
self
.
subTest
(
'
data match 2nd value
'
):
with
self
.
subTest
(
'
data match 2nd value
'
):
real_idx
=
get_index_from_data_picked
(
real_idx
es
=
get_index_from_data_picked
(
self
.
plotting_data
[
'
CH2
'
],
3
,
4
)
self
.
plotting_data
[
'
CH2
'
],
3
,
4
)
self
.
assertEqual
(
real_idx
,
3
)
self
.
assertEqual
(
real_idx
es
.
tolist
(),
[
3
]
)
def
test_type_up_down
(
self
):
def
test_type_up_down
(
self
):
# CH1 has plotType='upDownDots'
# CH1 has plotType='upDownDots'
with
self
.
subTest
(
'
data not match time
'
):
with
self
.
subTest
(
'
data not match time
'
):
real_idx
=
get_index_from_data_picked
(
real_idx
es
=
get_index_from_data_picked
(
self
.
plotting_data
[
'
CH1
'
],
1
,
-
0.5
)
self
.
plotting_data
[
'
CH1
'
],
1
,
-
0.5
)
self
.
assert
IsNone
(
real_idx
)
self
.
assert
Equal
(
len
(
real_idx
es
),
0
)
with
self
.
subTest
(
'
data=1 match time
'
):
with
self
.
subTest
(
'
data=1 match time
'
):
real_idx
=
get_index_from_data_picked
(
real_idx
es
=
get_index_from_data_picked
(
self
.
plotting_data
[
'
CH1
'
],
1
,
0.5
)
self
.
plotting_data
[
'
CH1
'
],
1
,
0.5
)
self
.
assertEqual
(
real_idx
,
0
)
self
.
assertEqual
(
real_idx
es
.
tolist
(),
[
0
]
)
with
self
.
subTest
(
'
data=0 match time
'
):
with
self
.
subTest
(
'
data=0 match time
'
):
real_idx
=
get_index_from_data_picked
(
real_idx
es
=
get_index_from_data_picked
(
self
.
plotting_data
[
'
CH1
'
],
3
,
-
0.5
)
self
.
plotting_data
[
'
CH1
'
],
3
,
-
0.5
)
self
.
assertEqual
(
real_idx
,
2
)
self
.
assertEqual
(
real_idxes
.
tolist
(),
[
2
])
def
test_2_overlapped_points
(
self
):
real_idxes
=
get_index_from_data_picked
(
self
.
plotting_data
[
'
CH1
'
],
6
,
-
0.5
)
self
.
assertEqual
(
real_idxes
.
tolist
(),
[
5
,
6
])
class
TestGetTotalMinyMaxy
(
TestCase
):
class
TestGetTotalMinyMaxy
(
TestCase
):
...
...
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