Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
pony
tshistory_supervision
Commits
e7718f7a61a3
Commit
f6b8ea2d
authored
Aug 13, 2019
by
Aurélien Campéas
Browse files
strip: add a safety belt for supervised series
And indeed we do not want to strip those.
parent
2cb2f0b4b9e9
Changes
2
Show whitespace changes
Inline
Side-by-side
test/test_supervision.py
View file @
e7718f7a
...
...
@@ -277,6 +277,42 @@ def test_manual_overrides(engine, tsh):
"""
,
manual
)
def
test_strip
(
engine
,
tsh
):
ts
=
genserie
(
datetime
(
2019
,
1
,
1
),
'D'
,
3
)
tsh
.
insert
(
engine
,
ts
,
'strip-unsupervised'
,
'test'
,
_insertion_date
=
utcdt
(
2019
,
1
,
1
)
)
csid
=
tsh
.
changeset_at
(
engine
,
'strip-unsupervised'
,
utcdt
(
2019
,
1
,
1
))
tsh
.
strip
(
engine
,
'strip-unsupervised'
,
csid
)
ts
=
genserie
(
datetime
(
2019
,
1
,
1
),
'D'
,
3
)
tsh
.
insert
(
engine
,
ts
,
'strip-handcrafted'
,
'test'
,
manual
=
True
,
_insertion_date
=
utcdt
(
2019
,
1
,
1
)
)
csid
=
tsh
.
changeset_at
(
engine
,
'strip-handcrafted'
,
utcdt
(
2019
,
1
,
1
))
tsh
.
strip
(
engine
,
'strip-handcrafted'
,
csid
)
ts
=
genserie
(
datetime
(
2019
,
1
,
1
),
'D'
,
3
)
tsh
.
insert
(
engine
,
ts
,
'strip-supervised'
,
'test'
,
_insertion_date
=
utcdt
(
2019
,
1
,
1
)
)
ts
=
genserie
(
datetime
(
2019
,
1
,
2
),
'D'
,
3
)
tsh
.
insert
(
engine
,
ts
,
'strip-supervised'
,
'test'
,
manual
=
True
,
_insertion_date
=
utcdt
(
2019
,
1
,
2
)
)
with
pytest
.
raises
(
ValueError
)
as
err
:
csid
=
tsh
.
changeset_at
(
engine
,
'strip-supervised'
,
utcdt
(
2019
,
1
,
1
))
tsh
.
strip
(
engine
,
'strip-supervised'
,
csid
)
def
test_handcrafted
(
engine
,
tsh
):
ts_begin
=
genserie
(
datetime
(
2010
,
1
,
1
),
'D'
,
10
)
tsh
.
insert
(
engine
,
ts_begin
,
'ts_only'
,
'test'
,
manual
=
True
)
...
...
tshistory_supervision/tsio.py
View file @
e7718f7a
...
...
@@ -152,6 +152,13 @@ class timeseries(basets):
super
().
rename
(
cn
,
oldname
,
newname
)
self
.
upstream
.
rename
(
cn
,
oldname
,
newname
)
@
tx
def
strip
(
self
,
cn
,
name
,
csid
):
if
self
.
supervision_status
(
cn
,
name
)
==
'supervised'
:
raise
ValueError
(
f
'supervised series `
{
name
}
` cannot be striped'
)
super
().
strip
(
cn
,
name
,
csid
)
# supervision specific API
@
tx
...
...
Write
Preview
Markdown
is supported
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