Skip to content

Commit 4e144d7

Browse files
committed
test upgrade 1.0.1 to itself
1 parent e43f2da commit 4e144d7

File tree

3 files changed

+133
-2
lines changed

3 files changed

+133
-2
lines changed

tests/test_upgrade.py

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ def test_upgrade_to_latest(datadir):
2020

2121
def test_1_0_0_workspace(datadir, caplog, monkeypatch):
2222
"""
23-
Test upgrading a workspace from 1.0.0
23+
Test upgrading a workspace from 1.0.0 to 1.0.1
2424
"""
2525
spec = json.load(open(datadir.joinpath("workspace_1.0.0.json"), encoding="utf-8"))
2626

@@ -37,7 +37,7 @@ def test_1_0_0_workspace(datadir, caplog, monkeypatch):
3737

3838
def test_1_0_0_patchset(datadir, caplog, monkeypatch):
3939
"""
40-
Test upgrading a patchset from 1.0.0
40+
Test upgrading a patchset from 1.0.0 to 1.0.1
4141
"""
4242
spec = json.load(open(datadir.joinpath("patchset_1.0.0.json"), encoding="utf-8"))
4343

@@ -50,3 +50,23 @@ def test_1_0_0_patchset(datadir, caplog, monkeypatch):
5050

5151
new_spec = pyhf.schema.upgrade(to_version='1.0.1').patchset(spec)
5252
assert new_spec['version'] == '1.0.1'
53+
54+
55+
def test_1_0_1_workspace(datadir):
56+
"""
57+
Test upgrading a workspace from 1.0.1 to 1.0.1
58+
"""
59+
spec = json.load(open(datadir.joinpath("workspace_1.0.1.json"), encoding="utf-8"))
60+
61+
new_spec = pyhf.schema.upgrade(to_version='1.0.1').workspace(spec)
62+
assert new_spec['version'] == '1.0.1'
63+
64+
65+
def test_1_0_1_patchset(datadir):
66+
"""
67+
Test upgrading a patchset from 1.0.1 to 1.0.1
68+
"""
69+
spec = json.load(open(datadir.joinpath("patchset_1.0.1.json"), encoding="utf-8"))
70+
71+
new_spec = pyhf.schema.upgrade(to_version='1.0.1').patchset(spec)
72+
assert new_spec['version'] == '1.0.1'
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"metadata": {
3+
"references": { "hepdata": "ins1234567" },
4+
"description": "patchset for validation/xmlimport_input/config/example.xml",
5+
"digests": { "sha256": "7c32ca3b8db75cbafcf5cd7ed4672fa2b1fa69e391c9b89068dd947a521866ec" },
6+
"labels": ["x"]
7+
},
8+
"patches": [
9+
{
10+
"metadata": {
11+
"name": "patch_channel1_signal_syst1",
12+
"values": [0]
13+
},
14+
"patch": [
15+
{
16+
"op": "replace",
17+
"path": "/channels/0/samples/0/modifiers/0/data/hi",
18+
"value": 1.2
19+
},
20+
{
21+
"op": "replace",
22+
"path": "/channels/0/samples/0/modifiers/0/data/lo",
23+
"value": 0.8
24+
}
25+
]
26+
}
27+
],
28+
"version": "1.0.0"
29+
}
Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
{
2+
"channels": [
3+
{
4+
"name": "singlechannel",
5+
"samples": [
6+
{
7+
"data": [
8+
5
9+
],
10+
"modifiers": [
11+
{
12+
"data": null,
13+
"name": "mu",
14+
"type": "normfactor"
15+
}
16+
],
17+
"name": "signal"
18+
},
19+
{
20+
"data": [
21+
50
22+
],
23+
"modifiers": [
24+
{
25+
"data": [
26+
6
27+
],
28+
"name": "uncorr_bkguncrt",
29+
"type": "shapesys"
30+
}
31+
],
32+
"name": "background"
33+
}
34+
]
35+
}
36+
],
37+
"measurements": [
38+
{
39+
"config": {
40+
"parameters": [
41+
{
42+
"bounds": [
43+
[
44+
0,
45+
10
46+
]
47+
],
48+
"fixed": false,
49+
"inits": [
50+
1
51+
],
52+
"name": "mu"
53+
},
54+
{
55+
"bounds": [
56+
[
57+
1e-10,
58+
10
59+
]
60+
],
61+
"fixed": false,
62+
"inits": [
63+
1
64+
],
65+
"name": "uncorr_bkguncrt"
66+
}
67+
],
68+
"poi": "mu"
69+
},
70+
"name": "measurement"
71+
}
72+
],
73+
"observations": [
74+
{
75+
"data": [
76+
50
77+
],
78+
"name": "singlechannel"
79+
}
80+
],
81+
"version": "1.0.0"
82+
}

0 commit comments

Comments
 (0)