Skip to content

Commit 89a7012

Browse files
authored
Merge pull request QuantEcon#643 from Smit-create/pytest_warn
MAINT: Fix pytest warnings
2 parents 060f3e6 + a1b2286 commit 89a7012

31 files changed

+71
-71
lines changed

quantecon/game_theory/game_generators/tests/test_bimatrix_generators.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
class TestBlottoGame:
17-
def setup(self):
17+
def setup_method(self):
1818
self.h, self.t = 4, 3
1919
rho = 0.5
2020
self.g = blotto_game(self.h, self.t, rho)
@@ -38,7 +38,7 @@ def test_seed(self):
3838

3939

4040
class TestRankingGame:
41-
def setup(self):
41+
def setup_method(self):
4242
self.n = 100
4343
self.g = ranking_game(self.n)
4444

@@ -85,7 +85,7 @@ def test_sgc_game():
8585

8686

8787
class TestTournamentGame:
88-
def setup(self):
88+
def setup_method(self):
8989
self.n = 5
9090
self.k = 3
9191
self.m = comb(self.n, self.k, exact=True)
@@ -116,7 +116,7 @@ def test_raises_value_error_too_large_inputs(self):
116116

117117

118118
class TestUnitVectorGame:
119-
def setup(self):
119+
def setup_method(self):
120120
self.n = 100
121121
self.g = unit_vector_game(self.n)
122122

quantecon/game_theory/tests/test_lemke_howson.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88

99
class TestLemkeHowson():
10-
def setup(self):
10+
def setup_method(self):
1111
self.game_dicts = []
1212

1313
# From von Stengel 2007 in Algorithmic Game Theory
@@ -30,7 +30,7 @@ def test_lemke_howson(self):
3030

3131

3232
class TestLemkeHowsonDegenerate():
33-
def setup(self):
33+
def setup_method(self):
3434
self.game_dicts = []
3535

3636
# From von Stengel 2007 in Algorithmic Game Theory

quantecon/game_theory/tests/test_mclennan_tourky.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class TestMclennanTourky():
13-
def setup(self):
13+
def setup_method(self):
1414
def anti_coordination(N, v):
1515
payoff_array = np.empty((2,)*N)
1616
payoff_array[0, :] = 1
@@ -56,7 +56,7 @@ def test_pure_nash(self):
5656

5757

5858
class TestMclennanTourkyInvalidInputs():
59-
def setup(self):
59+
def setup_method(self):
6060
self.bimatrix = [[(3, 3), (3, 2)],
6161
[(2, 2), (5, 6)],
6262
[(0, 3), (6, 1)]]
@@ -73,7 +73,7 @@ def test_mclennan_tourky_invalid_init_length(self):
7373

7474

7575
class TestEpsilonNash():
76-
def setup(self):
76+
def setup_method(self):
7777
def anti_coordination(N, v):
7878
payoff_array = np.empty((2,)*N)
7979
payoff_array[0, :] = 1

quantecon/game_theory/tests/test_normal_form_game.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
class TestPlayer_1opponent:
1818
"""Test the methods of Player with one opponent player"""
1919

20-
def setup(self):
20+
def setup_method(self):
2121
"""Setup a Player instance"""
2222
coordination_game_matrix = [[4, 0], [3, 2]]
2323
self.player = Player(coordination_game_matrix)
@@ -89,7 +89,7 @@ def test_dominated_actions(self):
8989
class TestPlayer_2opponents:
9090
"""Test the methods of Player with two opponent players"""
9191

92-
def setup(self):
92+
def setup_method(self):
9393
"""Setup a Player instance"""
9494
payoffs_2opponents = [[[3, 6],
9595
[4, 2]],
@@ -176,7 +176,7 @@ def test_player_corner_cases():
176176
class TestNormalFormGame_Sym2p:
177177
"""Test the methods of NormalFormGame with symmetric two players"""
178178

179-
def setup(self):
179+
def setup_method(self):
180180
"""Setup a NormalFormGame instance"""
181181
coordination_game_matrix = [[4, 0], [3, 2]]
182182
self.g = NormalFormGame(coordination_game_matrix)
@@ -194,7 +194,7 @@ def test_is_nash_mixed(self):
194194
class TestNormalFormGame_Asym2p:
195195
"""Test the methods of NormalFormGame with asymmetric two players"""
196196

197-
def setup(self):
197+
def setup_method(self):
198198
"""Setup a NormalFormGame instance"""
199199
self.BoS_bimatrix = np.array([[(3, 2), (1, 1)],
200200
[(0, 0), (2, 3)]])
@@ -234,7 +234,7 @@ def test_payoff_arrays(self):
234234
class TestNormalFormGame_3p:
235235
"""Test the methods of NormalFormGame with three players"""
236236

237-
def setup(self):
237+
def setup_method(self):
238238
"""Setup a NormalFormGame instance"""
239239
payoffs_2opponents = [[[3, 6],
240240
[4, 2]],
@@ -341,7 +341,7 @@ def test_normalformgame_payoff_profile_array_c_contiguous():
341341
class TestPlayer_0opponents:
342342
"""Test for trivial Player with no opponent player"""
343343

344-
def setup(self):
344+
def setup_method(self):
345345
"""Setup a Player instance"""
346346
self.payoffs = [0, 1, -1]
347347
self.player = Player(self.payoffs)
@@ -386,7 +386,7 @@ def test_dominated_actions(self):
386386
class TestNormalFormGame_1p:
387387
"""Test for trivial NormalFormGame with a single player"""
388388

389-
def setup(self):
389+
def setup_method(self):
390390
"""Setup a NormalFormGame instance"""
391391
data = [[0], [1], [1]]
392392
self.g = NormalFormGame(data)
@@ -444,7 +444,7 @@ def test_normalformgame_setitem_1p():
444444
# Trivial cases with one action #
445445

446446
class TestPlayer_1action:
447-
def setup(self):
447+
def setup_method(self):
448448
"""Setup a Player instance"""
449449
self.payoffs = [[0, 1]]
450450
self.player = Player(self.payoffs)

quantecon/game_theory/tests/test_pure_nash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class TestPureNashBruteForce():
13-
def setup(self):
13+
def setup_method(self):
1414
self.game_dicts = []
1515

1616
# Matching Pennies game with no pure nash equilibrium

quantecon/game_theory/tests/test_repeated_game.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99

1010
class TestAS():
11-
def setup(self):
11+
def setup_method(self):
1212
self.game_dicts = []
1313

1414
# Example from Abreu and Sannikov (2014)

quantecon/game_theory/tests/test_support_enumeration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def random_skew_sym(n, m=None, random_state=None):
2929

3030

3131
class TestSupportEnumeration():
32-
def setup(self):
32+
def setup_method(self):
3333
self.game_dicts = []
3434

3535
# From von Stengel 2007 in Algorithmic Game Theory

quantecon/game_theory/tests/test_vertex_enumeration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111

1212
class TestVertexEnumeration:
13-
def setup(self):
13+
def setup_method(self):
1414
self.game_dicts = []
1515

1616
# From von Stengel 2007 in Algorithmic Game Theory
@@ -71,7 +71,7 @@ def test_vertex_enumeration_invalid_g():
7171

7272

7373
class TestBestResponsePolytope:
74-
def setup(self):
74+
def setup_method(self):
7575
# From von Stengel 2007 in Algorithmic Game Theory
7676
bimatrix = [[(3, 3), (3, 2)],
7777
[(2, 2), (5, 6)],

quantecon/markov/tests/test_approximation.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
class TestTauchen:
1313

14-
def setup(self):
14+
def setup_method(self):
1515
self.rho, self.sigma_u = np.random.rand(2)
1616
self.n = np.random.randint(3, 25)
1717
self.m = np.random.randint(5)
@@ -54,7 +54,7 @@ def test_states_sum_0(self):
5454

5555
class TestRouwenhorst:
5656

57-
def setup(self):
57+
def setup_method(self):
5858
self.rho, self.sigma = np.random.uniform(0, 1, size=2)
5959
self.n = np.random.randint(3, 26)
6060
self.ybar = np.random.randint(0, 11)

quantecon/markov/tests/test_core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class Test_markovchain_stationary_distributions_KMRMarkovMatrix2():
191191
p = 1/3
192192
TOL = 1e-2
193193

194-
def setup(self):
194+
def setup_method(self):
195195
""" Setup a KMRMarkovMatrix and Compute Stationary Values """
196196
self.P = KMR_Markov_matrix_sequential(self.N, self.p, self.epsilon)
197197
self.mc = MarkovChain(self.P)
@@ -409,7 +409,7 @@ def test_mc_sample_path_lln():
409409

410410

411411
class TestMCStateValues:
412-
def setup(self):
412+
def setup_method(self):
413413
state_values = [[0, 1], [2, 3], [4, 5]] # Pass python list
414414
self.state_values = np.array(state_values)
415415

0 commit comments

Comments
 (0)