Skip to content

Commit a866337

Browse files
committed
Remove duplicate definitions in test_pipeline
1 parent f4af63c commit a866337

File tree

1 file changed

+14
-24
lines changed

1 file changed

+14
-24
lines changed

test/test_pipeline.py

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,15 @@
2929
classical_sources="all"
3030
)
3131

32+
bellScenario = InflationProblem({"Lambda": ["A", "B"]},
33+
outcomes_per_party=[2, 2],
34+
settings_per_party=[2, 2],
35+
inflation_level_per_source=[1])
36+
bellScenario_c = InflationProblem({"Lambda": ["A", "B"]},
37+
outcomes_per_party=[2, 2],
38+
settings_per_party=[2, 2],
39+
inflation_level_per_source=[1],
40+
classical_sources='all')
3241

3342
class TestMonomialGeneration(unittest.TestCase):
3443
bilocalSDP_commuting = InflationSDP(bilocality_c)
@@ -300,16 +309,6 @@ def GHZ(self, v):
300309
dist[a, b, c, 0, 0, 0] = (1-v)/8
301310
return dist
302311

303-
bellScenario = InflationProblem({"Lambda": ["A", "B"]},
304-
outcomes_per_party=[2, 2],
305-
settings_per_party=[2, 2],
306-
inflation_level_per_source=[1])
307-
bellScenario_c = InflationProblem({"Lambda": ["A", "B"]},
308-
outcomes_per_party=[2, 2],
309-
settings_per_party=[2, 2],
310-
inflation_level_per_source=[1],
311-
classical_sources='all')
312-
313312
cutInflation = InflationProblem({"lambda": ["a", "b"],
314313
"mu": ["b", "c"],
315314
"sigma": ["a", "c"]},
@@ -367,7 +366,7 @@ def test_bounds(self):
367366
f"{sdp.objective_value}.")
368367

369368
def test_CHSH(self):
370-
sdp = InflationSDP(self.bellScenario)
369+
sdp = InflationSDP(bellScenario)
371370
sdp.generate_relaxation("npa1")
372371
self.assertEqual(sdp.n_columns, 5,
373372
"The number of generating columns is not correct.")
@@ -608,7 +607,7 @@ def test_new_indices(self):
608607
" LPI constraints are not assigned correct indices.")
609608

610609
def test_supports(self):
611-
sdp = InflationSDP(self.bellScenario, supports_problem=True)
610+
sdp = InflationSDP(bellScenario, supports_problem=True)
612611
sdp.generate_relaxation("local1")
613612
pr_support = np.zeros((2, 2, 2, 2))
614613
for a, b, x, y in np.ndindex(*pr_support.shape):
@@ -680,7 +679,7 @@ def test_instrumental(self):
680679
"scenario is not being recognized as such.")
681680

682681
def test_supports(self):
683-
lp = InflationLP(TestSDPOutput.bellScenario_c, supports_problem=True)
682+
lp = InflationLP(bellScenario_c, supports_problem=True)
684683
with self.subTest(msg="Incompatible support"):
685684
pr_support = np.zeros((2, 2, 2, 2))
686685
for a, b, x, y in np.ndindex(*pr_support.shape):
@@ -954,15 +953,6 @@ def test_instrumental_nonfanout(self):
954953

955954

956955
class TestBell(TestPipelineLP):
957-
bellScenario = InflationProblem({"Lambda": ["A", "B"]},
958-
outcomes_per_party=[2, 2],
959-
settings_per_party=[2, 2],
960-
inflation_level_per_source=[1])
961-
bellScenario_c = InflationProblem({"Lambda": ["A", "B"]},
962-
outcomes_per_party=[2, 2],
963-
settings_per_party=[2, 2],
964-
inflation_level_per_source=[1],
965-
classical_sources='all')
966956

967957
def _CHSH(self, **args):
968958
lp = args["scenario"]
@@ -986,7 +976,7 @@ def p_Signalling_to_Bob(self, v):
986976
return dist
987977

988978
def test_bell_fanout(self):
989-
bell = InflationLP(self.bellScenario_c)
979+
bell = InflationLP(bellScenario_c)
990980
args = {"scenario": bell,
991981
"truth_columns": 16,
992982
"truth_obj": 2,
@@ -997,7 +987,7 @@ def test_bell_fanout(self):
997987
self._run(**args)
998988

999989
def test_bell_nonfanout(self):
1000-
bell = InflationLP(self.bellScenario)
990+
bell = InflationLP(bellScenario)
1001991
args = {"scenario": bell,
1002992
"truth_columns": 9,
1003993
"truth_obj": 2,

0 commit comments

Comments
 (0)