Skip to content

Commit 8df06b1

Browse files
committed
Fix some of F841 errors
1 parent ed51e46 commit 8df06b1

File tree

13 files changed

+15
-29
lines changed

13 files changed

+15
-29
lines changed

quantecon/game_theory/game_generators/tests/test_bimatrix_generators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def test_seed(self):
112112
@raises(ValueError)
113113
def test_raises_value_error_too_large_inputs(self):
114114
n, k = 100, 50
115-
g = tournament_game(n, k)
115+
tournament_game(n, k)
116116

117117

118118
class TestUnitVectorGame:
@@ -149,7 +149,7 @@ def test_redraw(self):
149149
@raises(ValueError)
150150
def test_raises_value_error_avoid_pure_nash_n_1(self):
151151
n = 1
152-
g = unit_vector_game(n, avoid_pure_nash=True)
152+
unit_vector_game(n, avoid_pure_nash=True)
153153

154154

155155
def test_payoff_range():

quantecon/game_theory/tests/test_normal_form_game.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -482,43 +482,43 @@ def test_player_repr():
482482

483483
@raises(ValueError)
484484
def test_player_zero_actions():
485-
p = Player([[]])
485+
Player([[]])
486486

487487

488488
@raises(ValueError)
489489
def test_normalformgame_invalid_input_players_shape_inconsistent():
490490
p0 = Player(np.zeros((2, 3)))
491491
p1 = Player(np.zeros((2, 3)))
492-
g = NormalFormGame([p0, p1])
492+
NormalFormGame([p0, p1])
493493

494494

495495
@raises(ValueError)
496496
def test_normalformgame_invalid_input_players_num_inconsistent():
497497
p0 = Player(np.zeros((2, 2, 2)))
498498
p1 = Player(np.zeros((2, 2, 2)))
499-
g = NormalFormGame([p0, p1])
499+
NormalFormGame([p0, p1])
500500

501501

502502
@raises(ValueError)
503503
def test_normalformgame_invalid_input_players_dtype_inconsistent():
504504
p0 = Player(np.zeros((2, 2), dtype=int))
505505
p1 = Player(np.zeros((2, 2), dtype=float))
506-
g = NormalFormGame([p0, p1])
506+
NormalFormGame([p0, p1])
507507

508508

509509
@raises(ValueError)
510510
def test_normalformgame_invalid_input_nosquare_matrix():
511-
g = NormalFormGame(np.zeros((2, 3)))
511+
NormalFormGame(np.zeros((2, 3)))
512512

513513

514514
@raises(ValueError)
515515
def test_normalformgame_invalid_input_payoff_profiles():
516-
g = NormalFormGame(np.zeros((2, 2, 1)))
516+
NormalFormGame(np.zeros((2, 2, 1)))
517517

518518

519519
@raises(ValueError)
520520
def test_normalformgame_zero_actions():
521-
g = NormalFormGame((2, 0))
521+
NormalFormGame((2, 0))
522522

523523

524524
# Utility functions #

quantecon/game_theory/tests/test_support_enumeration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_no_error_skew_sym(self):
6666
n, m = 3, 2
6767
seed = 7028
6868
g = random_skew_sym(n, m, random_state=seed)
69-
NEs = support_enumeration(g)
69+
support_enumeration(g)
7070

7171

7272
@raises(TypeError)

quantecon/game_theory/vertex_enumeration.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,6 @@ def __init__(self, opponent_player, idx=0, qhull_options=None):
225225
# Shift the payoffs to be nonnegative and have no zero column
226226
col_mins = B.min(axis=0)
227227
col_maxs = B.max(axis=0)
228-
neg_cols = (col_mins < 0)
229228
nonpos_const_cols = (col_maxs == col_mins) * (col_mins <= 0)
230229
shifts = np.zeros(m)
231230
shifts[col_mins < 0] = -col_mins[col_mins < 0]

quantecon/markov/core.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,6 @@ def cdfs(self):
429429
def cdfs1d(self):
430430
if (self._cdfs1d is None) and self.is_sparse:
431431
data = self.P.data
432-
indices = self.P.indices
433432
indptr = self.P.indptr
434433

435434
cdfs1d = np.empty(self.P.nnz, order='C')

quantecon/markov/tests/test_core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,7 @@ def test_get_index():
512512
@raises(ValueError)
513513
def test_raises_value_error_non_2dim():
514514
"""Test with non 2dim input"""
515-
mc = MarkovChain(np.array([0.4, 0.6]))
515+
MarkovChain(np.array([0.4, 0.6]))
516516

517517

518518
def test_raises_value_error_non_sym():

quantecon/optimize/tests/test_nelder_mead.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,6 @@ def colville(x):
106106
@njit
107107
def styblinski_tang(x):
108108
# https://www.sfu.ca/~ssurjano/stybtang.html
109-
d = x.size
110109
f = 0.5 * (x ** 4 - 16 * x ** 2 + 5 * x).sum()
111110
return -f
112111

@@ -288,8 +287,6 @@ def test_styblinski_tang(self):
288287

289288
def test_goldstein_price(self):
290289
x0 = np.array([-1.5, 0.5])
291-
bounds = np.array([[-2., 2.],
292-
[-2., 2.]])
293290

294291
results = nelder_mead(goldstein_price, x0)
295292

@@ -335,19 +332,13 @@ def test_discontinuous(self):
335332

336333
@raises(ValueError)
337334
def test_invalid_bounds_1():
338-
vertices = np.array([[-2., 1.],
339-
[1.05 * -2., 1.],
340-
[-2., 1.05 * 1.]])
341335
x0 = np.array([-2., 1.])
342336
bounds = np.array([[10., -10.], [10., -10.]])
343337
nelder_mead(rosenbrock, x0, bounds=bounds)
344338

345339

346340
@raises(ValueError)
347341
def test_invalid_bounds_2():
348-
vertices = np.array([[-2., 1.],
349-
[1.05 * -2., 1.],
350-
[-2., 1.05 * 1.]])
351342
x0 = np.array([-2., 1.])
352343
bounds = np.array([[10., -10., 10., -10.]])
353344
nelder_mead(rosenbrock, x0, bounds=bounds)

quantecon/tests/test_compute_fp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,4 +137,4 @@ def test_raises_value_error_nonpositive_max_iter():
137137
f = lambda x: 0.5*x
138138
init = 1.
139139
max_iter = 0
140-
fp = compute_fixed_point(f, init, max_iter=max_iter)
140+
compute_fixed_point(f, init, max_iter=max_iter)

quantecon/tests/test_dle.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ def setUp(self):
3535
deltah = np.array([[.9]])
3636
thetah = np.array([[1]]) - deltah
3737
ub = np.array([[30, 0, 0]])
38-
x0 = np.array([[5, 150, 1, 0, 0]]).T
3938

4039
information = (a22, c2, ub, ud)
4140
technology = (phic, phig, phii, gamma, deltak, thetak)

quantecon/tests/test_graph_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def test_node_labels_subgraph():
288288
@raises(ValueError)
289289
def test_raises_value_error_non_sym():
290290
"""Test with non symmetric input"""
291-
g = DiGraph(np.array([[0.4, 0.6]]))
291+
DiGraph(np.array([[0.4, 0.6]]))
292292

293293

294294
def test_raises_non_homogeneous_node_labels():

0 commit comments

Comments
 (0)