Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sgn-ts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
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
greg
sgn-ts
Commits
84ff6780
Commit
84ff6780
authored
3 months ago
by
James Kennington
Browse files
Options
Downloads
Patches
Plain Diff
add tests for new conditions of validation
parent
c84cce9f
Branches
feature-validate-buffers
No related tags found
1 merge request
!86
Add more validation for buffers
Pipeline
#690417
failed
3 months ago
Stage: build
Stage: test
Stage: .post
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/core/test_buffer.py
+43
-0
43 additions, 0 deletions
tests/core/test_buffer.py
with
43 additions
and
0 deletions
tests/core/test_buffer.py
0 → 100644
+
43
−
0
View file @
84ff6780
"""
Tests for sgnts.base.buffer module.
"""
import
numpy
import
pytest
from
sgnts.base
import
SeriesBuffer
,
TSFrame
class
TestTSFrame
:
"""
Test group for TSFrame validation
"""
def
test_init
(
self
):
"""
Test TSFrame initialization
"""
b1
=
SeriesBuffer
(
offset
=
0
,
sample_rate
=
2048
,
data
=
numpy
.
random
.
rand
(
2048
),
shape
=
(
2048
,)
)
b2
=
SeriesBuffer
(
offset
=
b1
.
end_offset
,
sample_rate
=
2048
,
data
=
numpy
.
random
.
rand
(
2048
)
)
frame
=
TSFrame
(
buffers
=
[
b1
,
b2
])
assert
isinstance
(
frame
,
TSFrame
)
def
test_init_err_discontinuous
(
self
):
"""
Test TSFrame initialization with error
"""
b1
=
SeriesBuffer
(
offset
=
0
,
sample_rate
=
2048
,
data
=
numpy
.
random
.
rand
(
2048
),
shape
=
(
2048
,)
)
b2
=
SeriesBuffer
(
offset
=
2
*
b1
.
end_offset
,
sample_rate
=
2048
,
data
=
numpy
.
random
.
rand
(
2048
)
)
with
pytest
.
raises
(
ValueError
):
TSFrame
(
buffers
=
[
b1
,
b2
])
def
test_init_err_mixed_types
(
self
):
"""
Test TSFrame initialization with error
"""
b1
=
SeriesBuffer
(
offset
=
0
,
sample_rate
=
2048
,
data
=
None
,
shape
=
(
2048
,)
)
b2
=
SeriesBuffer
(
offset
=
2
*
b1
.
end_offset
,
sample_rate
=
2048
,
data
=
numpy
.
random
.
rand
(
2048
)
)
with
pytest
.
raises
(
ValueError
):
TSFrame
(
buffers
=
[
b1
,
b2
])
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