Skip to content

Commit d1b0479

Browse files
committed
TEST: Updates for pytest
1 parent fecbcc7 commit d1b0479

File tree

4 files changed

+9
-52
lines changed

4 files changed

+9
-52
lines changed

quantecon/game_theory/tests/test_brd.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
class TestBRD:
1414
'''Test the methods of BRD'''
1515

16-
def setUp(self):
16+
def setup_method(self):
1717
'''Setup a BRD instance'''
1818
# 2x2 coordination game with action 1 risk-dominant
1919
payoff_matrix = [[4, 0],
@@ -40,7 +40,7 @@ def test_time_series_2(self):
4040
class TestKMR:
4141
'''Test the methods of KMR'''
4242

43-
def setUp(self):
43+
def setup_method(self):
4444
payoff_matrix = [[4, 0],
4545
[3, 2]]
4646
self.N = 4
@@ -57,7 +57,7 @@ def test_time_series(self):
5757
class TestSamplingBRD:
5858
'''Test the methods of SamplingBRD'''
5959

60-
def setUp(self):
60+
def setup_method(self):
6161
payoff_matrix = [[4, 0],
6262
[3, 2]]
6363
self.N = 4
@@ -69,13 +69,3 @@ def test_time_series(self):
6969
random_state=np.random.RandomState(seed))
7070
for i in range(2)]
7171
assert_array_equal(x[0], x[1])
72-
73-
74-
if __name__ == '__main__':
75-
import sys
76-
import nose
77-
78-
argv = sys.argv[:]
79-
argv.append('--verbose')
80-
argv.append('--nocapture')
81-
nose.main(argv=argv, defaultTest=__file__)

quantecon/game_theory/tests/test_fictplay.py

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Tests for fictplay.py
55
66
"""
7-
87
import numpy as np
98
from numpy.testing import assert_array_almost_equal
109
from scipy.stats import norm
@@ -14,7 +13,7 @@
1413

1514
class TestFictitiousPlayDecreaingGain:
1615

17-
def setUp(self):
16+
def setup_method(self):
1817
'''Setup a FictitiousPlay instance'''
1918
# symmetric 2x2 coordination game
2019
matching_pennies = [[(1, -1), (-1, 1)],
@@ -37,7 +36,7 @@ def test_time_series(self):
3736

3837
class TestFictitiousPlayConstantGain:
3938

40-
def setUp(self):
39+
def setup_method(self):
4140
matching_pennies = [[(1, -1), (-1, 1)],
4241
[(-1, 1), (1, -1)]]
4342
self.fp = FictitiousPlay(matching_pennies, gain=0.1)
@@ -58,7 +57,7 @@ def test_time_series(self):
5857

5958
class TestStochasticFictitiosuPlayDecreaingGain:
6059

61-
def setUp(self):
60+
def setup_method(self):
6261
matching_pennies = [[(1, -1), (-1, 1)],
6362
[(-1, 1), (1, -1)]]
6463
distribution = norm()
@@ -83,7 +82,7 @@ def test_time_series(self):
8382

8483
class TestStochasticFictitiosuPlayConstantGain:
8584

86-
def setUp(self):
85+
def setup_method(self):
8786
matching_pennies = [[(1, -1), (-1, 1)],
8887
[(-1, 1), (1, -1)]]
8988
distribution = norm()
@@ -104,13 +103,3 @@ def test_time_series(self):
104103
for i in range(2)]
105104
assert_array_almost_equal(x[0][0], x[1][0])
106105
assert_array_almost_equal(x[0][1], x[1][1])
107-
108-
109-
if __name__ == '__main__':
110-
import sys
111-
import nose
112-
113-
argv = sys.argv[:]
114-
argv.append('--verbose')
115-
argv.append('--nocapture')
116-
nose.main(argv=argv, defaultTest=__file__)

quantecon/game_theory/tests/test_localint.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Tests for localint.py
55
66
"""
7-
87
import numpy as np
98
from numpy.testing import assert_array_equal, assert_equal
109

@@ -14,7 +13,7 @@
1413
class TestLocalInteraction:
1514
'''Test the methods of LocalInteraction'''
1615

17-
def setUp(self):
16+
def setup_method(self):
1817
'''Setup a LocalInteraction instance'''
1918
payoff_matrix = np.asarray([[4, 0], [2, 3]])
2019
adj_matrix = np.asarray([[0, 1, 3],
@@ -56,13 +55,3 @@ def test_time_series_asynchronous_revision_with_player_index(self):
5655
actions=init_actions,
5756
player_ind_seq=player_ind_seq),
5857
x)
59-
60-
61-
if __name__ == '__main__':
62-
import sys
63-
import nose
64-
65-
argv = sys.argv[:]
66-
argv.append('--verbose')
67-
argv.append('--nocapture')
68-
nose.main(argv=argv, defaultTest=__file__)

quantecon/game_theory/tests/test_logitdyn.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
Tests for logitdyn.py
55
66
"""
7-
87
import numpy as np
98
from numpy.testing import assert_array_equal, assert_array_almost_equal_nulp
109

@@ -14,7 +13,7 @@
1413
class TestLogitDynamics:
1514
'''Test the methods of LogitDynamics'''
1615

17-
def setUp(self):
16+
def setup_method(self):
1817
'''Setup a LogitDynamics instance'''
1918
# symmetric 2x2 coordination game
2019
payoff_matrix = [[4, 0],
@@ -54,13 +53,3 @@ def test_set_choice_probs_with_asymmetric_payoff_matrix():
5453
cdfs_computed = cdfs_computed / cdfs_computed[..., [-1]] # Normalized
5554

5655
assert_array_almost_equal_nulp(cdfs_computed, cdfs)
57-
58-
59-
if __name__ == '__main__':
60-
import sys
61-
import nose
62-
63-
argv = sys.argv[:]
64-
argv.append('--verbose')
65-
argv.append('--nocapture')
66-
nose.main(argv=argv, defaultTest=__file__)

0 commit comments

Comments
 (0)