Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LISA Instrument
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
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LISA Simulation
LISA Instrument
Commits
da79ec90
Commit
da79ec90
authored
3 years ago
by
Jean-Baptiste Bayle
Browse files
Options
Downloads
Patches
Plain Diff
Add some unit tests
parent
c1e69b0f
No related branches found
No related tags found
1 merge request
!94
Resolve "Adopt new nomenclature"
Pipeline
#158805
passed
3 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_instrument.py
+28
-0
28 additions, 0 deletions
tests/test_instrument.py
with
28 additions
and
0 deletions
tests/test_instrument.py
+
28
−
0
View file @
da79ec90
...
...
@@ -2,6 +2,7 @@
# -*- coding: utf-8 -*-
# pylint: disable=missing-module-docstring
import
pytest
from
lisainstrument
import
Instrument
...
...
@@ -9,3 +10,30 @@ def test_run():
"""
Test that simulations can run.
"""
instru
=
Instrument
(
size
=
100
)
instru
.
simulate
()
def
test_run_no_aafilter
():
"""
Test that simulations can run with no filter.
"""
instru
=
Instrument
(
size
=
100
,
aafilter
=
None
)
instru
.
simulate
()
@pytest.mark.skip
(
reason
=
"
do not know why this fails
"
)
def
test_run_no_upsampling
():
"""
Test that simulations can run with no filter.
"""
instru
=
Instrument
(
size
=
100
,
physics_upsampling
=
1
,
aafilter
=
None
)
instru
.
simulate
()
def
test_locking
():
"""
Test that simulations can run with various lock configurations.
"""
# Test six free-running lasers
Instrument
(
size
=
100
,
lock
=
'
six
'
).
simulate
()
# Test non-swap configurations
for
i
in
range
(
1
,
6
):
for
primary
in
[
'
12
'
,
'
23
'
,
'
31
'
,
'
13
'
,
'
32
'
,
'
21
'
]:
Instrument
(
size
=
100
,
lock
=
f
'
N
{
i
}
-
{
primary
}
'
).
simulate
()
# Test that any other raises an error
with
pytest
.
raises
(
ValueError
):
Instrument
(
size
=
100
,
lock
=
'
whatever
'
)
with
pytest
.
raises
(
ValueError
):
Instrument
(
size
=
100
,
lock
=
'
N7-12
'
)
with
pytest
.
raises
(
ValueError
):
Instrument
(
size
=
100
,
lock
=
'
N1-67
'
)
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