@@ -33,8 +33,8 @@ def patch():
3333 ],
3434)
3535def test_patchset_invalid_spec (datadir , patchset_file ):
36- with open (datadir .joinpath (patchset_file ), encoding = "utf-8" ) as patch_file :
37- patchsetspec = json .load (patch_file )
36+ with open (datadir .joinpath (patchset_file ), encoding = "utf-8" ) as patchset_spec_file :
37+ patchsetspec = json .load (patchset_spec_file )
3838 with pytest .raises (pyhf .exceptions .InvalidSpecification ):
3939 pyhf .PatchSet (patchsetspec )
4040
@@ -48,8 +48,8 @@ def test_patchset_invalid_spec(datadir, patchset_file):
4848 ],
4949)
5050def test_patchset_bad (datadir , patchset_file ):
51- with open (datadir .joinpath (patchset_file ), encoding = "utf-8" ) as patch_file :
52- patchsetspec = json .load (patch_file )
51+ with open (datadir .joinpath (patchset_file ), encoding = "utf-8" ) as patchset_spec_file :
52+ patchsetspec = json .load (patchset_spec_file )
5353 with pytest .raises (pyhf .exceptions .InvalidPatchSet ):
5454 pyhf .PatchSet (patchsetspec )
5555
@@ -102,29 +102,29 @@ def test_patchset_repr(patchset):
102102def test_patchset_verify (datadir ):
103103 with open (
104104 datadir .joinpath ("example_patchset.json" ), encoding = "utf-8"
105- ) as patch_file :
106- patchset = pyhf .PatchSet (json .load (patch_file ))
107- with open (datadir .joinpath ("example_bkgonly.json" ), encoding = "utf-8" ) as ws_file :
108- ws = pyhf .Workspace (json .load (ws_file ))
105+ ) as patchset_file :
106+ patchset = pyhf .PatchSet (json .load (patchset_file ))
107+ with open (datadir .joinpath ("example_bkgonly.json" ), encoding = "utf-8" ) as bkg_file :
108+ ws = pyhf .Workspace (json .load (bkg_file ))
109109 assert patchset .verify (ws ) is None
110110
111111
112112def test_patchset_verify_failure (datadir ):
113113 with open (
114114 datadir .joinpath ("example_patchset.json" ), encoding = "utf-8"
115- ) as patch_file :
116- patchset = pyhf .PatchSet (json .load (patch_file ))
115+ ) as patchset_file :
116+ patchset = pyhf .PatchSet (json .load (patchset_file ))
117117 with pytest .raises (pyhf .exceptions .PatchSetVerificationError ):
118118 assert patchset .verify ({})
119119
120120
121121def test_patchset_apply (datadir ):
122122 with open (
123123 datadir .joinpath ("example_patchset.json" ), encoding = "utf-8"
124- ) as patch_file :
125- patchset = pyhf .PatchSet (json .load (patch_file ))
126- with open (datadir .joinpath ("example_bkgonly.json" ), encoding = "utf-8" ) as ws_file :
127- ws = pyhf .Workspace (json .load (ws_file ))
124+ ) as patchset_file :
125+ patchset = pyhf .PatchSet (json .load (patchset_file ))
126+ with open (datadir .joinpath ("example_bkgonly.json" ), encoding = "utf-8" ) as bkg_file :
127+ ws = pyhf .Workspace (json .load (bkg_file ))
128128 with mock .patch ('pyhf.patchset.PatchSet.verify' ) as m :
129129 assert m .call_count == 0
130130 assert patchset .apply (ws , 'patch_channel1_signal_syst1' )
@@ -149,9 +149,10 @@ def test_patch_equality(patch):
149149
150150def test_patchset_get_string_values (datadir ):
151151 with open (
152- datadir .joinpath ('patchset_good_stringvalues.json' ), encoding = "utf-8"
153- ) as patch_file :
154- patchset = pyhf .PatchSet (json .load (patch_file ))
152+ datadir .joinpath ("patchset_good_stringvalues.json" ), encoding = "utf-8"
153+ ) as patchset_file :
154+ patchset = pyhf .PatchSet (json .load (patchset_file ))
155+
155156 assert patchset ["Gtt_2100_5000_800" ]
156157 assert patchset ["Gbb_2200_5000_800" ]
157158 assert patchset [[2100 , 800 , "Gtt" ]]
0 commit comments