Skip to content

Commit

Permalink
Rename setup to setup_method
Browse files Browse the repository at this point in the history
  • Loading branch information
Smit-create committed Oct 28, 2022
1 parent de13b93 commit a1b2286
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
2 changes: 1 addition & 1 deletion quantecon/tests/test_compute_fp.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
class TestFPLogisticEquation():

@classmethod
def setup(cls):
def setup_method(cls):
cls.mu_1 = 0.2 # 0 is unique fixed point forall x_0 \in [0, 1]

# (4mu - 1)/(4mu) is a fixed point forall x_0 \in [0, 1]
Expand Down
2 changes: 1 addition & 1 deletion quantecon/tests/test_discrete_rv.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
class TestDiscreteRV:

@classmethod
def setup(cls):
def setup_method(cls):
x = np.random.rand(10)
x /= x.sum()
# make sure it sums to 1
Expand Down
2 changes: 1 addition & 1 deletion quantecon/tests/test_ecdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
class TestECDF:

@classmethod
def setup(cls):
def setup_method(cls):
cls.obs = np.random.rand(40) # observations defining dist
cls.ecdf = ECDF(cls.obs)

Expand Down
12 changes: 6 additions & 6 deletions quantecon/tests/test_estspec.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
class PeriodogramBase:

@classmethod
def setup(cls):
def setup_method(cls):
if cls is PeriodogramBase:
raise pytest.skip("Skip PeriodogramBase tests" +
" it's a base class")
Expand Down Expand Up @@ -47,10 +47,10 @@ def test_func_I(self):
class TestPeriodogram(PeriodogramBase):

@classmethod
def setup(cls):
def setup_method(cls):
if cls is PeriodogramBase:
raise pytest.skip("Skip BaseTest tests, it's a base class")
super(TestPeriodogram, cls).setup()
super(TestPeriodogram, cls).setup_method()
cls.window_length = 7
cls.w_20, cls.Iw_20 = periodogram(x_20)
cls.w_21, cls.Iw_21 = periodogram(x_21)
Expand All @@ -60,10 +60,10 @@ def setup(cls):
class TestArPeriodogram(PeriodogramBase):

@classmethod
def setup(cls):
def setup_method(cls):
if cls is PeriodogramBase:
raise pytest.skip("Skip BaseTest tests, it's a base class")
super(TestArPeriodogram, cls).setup()
super(TestArPeriodogram, cls).setup_method()
cls.window_length = 7
cls.w_20, cls.Iw_20 = ar_periodogram(x_20)
cls.w_21, cls.Iw_21 = ar_periodogram(x_21)
Expand All @@ -81,7 +81,7 @@ def test_func_Iw_shape_even_x(self):
class TestSmooth:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_20 = np.random.rand(20)
cls.x_21 = np.random.rand(21)
cls.window_length = 7
Expand Down
28 changes: 14 additions & 14 deletions quantecon/tests/test_quad.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
class TestQuadrect:

@classmethod
def setup(cls):
def setup_method(cls):
## Create Python Data for quadrect
# Create the python data -- similar to notebook code
kinds = ["trap", "simp", "lege", "N", "W", "H", "R"]
Expand Down Expand Up @@ -229,7 +229,7 @@ def test_quadrect_2d_H2(self):
class TestQnwcheb:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_cheb_1, cls.w_cheb_1 = qnwcheb(n, a, b)
cls.x_cheb_3, cls.w_cheb_3 = qnwcheb(n_3, a_3, b_3)

Expand All @@ -249,7 +249,7 @@ def test_qnwcheb_weights_3d(self):
class TestQnwequiN:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_equiN_1, cls.w_equiN_1 = qnwequi(n, a, b, "N")
cls.x_equiN_3, cls.w_equiN_3 = qnwequi(n_3, a_3, b_3, "N")

Expand All @@ -269,7 +269,7 @@ def test_qnwequiN_weights_3d(self):
class TestQnwequiW:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_equiW_1, cls.w_equiW_1 = qnwequi(n, a, b, "W")
cls.x_equiW_3, cls.w_equiW_3 = qnwequi(n_3, a_3, b_3, "W")

Expand All @@ -289,7 +289,7 @@ def test_qnwequiW_weights_3d(self):
class TestQnwequiH:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_equiH_1, cls.w_equiH_1 = qnwequi(n, a, b, "H")
cls.x_equiH_3, cls.w_equiH_3 = qnwequi(n_3, a_3, b_3, "H")

Expand All @@ -309,7 +309,7 @@ def test_qnwequiH_weights_3d(self):
class TestQnwequiR:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_equiR_1, cls.w_equiR_1 = qnwequi(n, a, b, "R", random_state=41)
temp, cls.w_equiR_3 = qnwequi(n_3, a_3, b_3, "R", random_state=42)

Expand Down Expand Up @@ -346,7 +346,7 @@ def test_qnwequiR_weights_3d(self):
class TestQnwlege:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_lege_1, cls.w_lege_1 = qnwlege(n, a, b)
cls.x_lege_3, cls.w_lege_3 = qnwlege(n_3, a_3, b_3)

Expand All @@ -366,7 +366,7 @@ def test_qnwlege_weights_3d(self):
class TestQnwnorm:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_norm_1, cls.w_norm_1 = qnwnorm(n, a, b)
cls.x_norm_3, cls.w_norm_3 = qnwnorm(n_3, mu_3d, sigma2_3d)

Expand All @@ -386,7 +386,7 @@ def test_qnwnorm_weights_3d(self):
class TestQnwlogn:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_logn_1, cls.w_logn_1 = qnwlogn(n, a, b)
cls.x_logn_3, cls.w_logn_3 = qnwlogn(n_3, mu_3d, sigma2_3d)

Expand All @@ -406,7 +406,7 @@ def test_qnwlogn_weights_3d(self):
class TestQnwsimp:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_simp_1, cls.w_simp_1 = qnwsimp(n, a, b)
cls.x_simp_3, cls.w_simp_3 = qnwsimp(n_3, a_3, b_3)

Expand All @@ -426,7 +426,7 @@ def test_qnwsimp_weights_3d(self):
class TestQnwtrap:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_trap_1, cls.w_trap_1 = qnwtrap(n, a, b)
cls.x_trap_3, cls.w_trap_3 = qnwtrap(n_3, a_3, b_3)

Expand All @@ -446,7 +446,7 @@ def test_qnwtrap_weights_3d(self):
class TestQnwunif:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_unif_1, cls.w_unif_1 = qnwunif(n, a, b)
cls.x_unif_3, cls.w_unif_3 = qnwunif(n_3, a_3, b_3)

Expand All @@ -466,7 +466,7 @@ def test_qnwunif_weights_3d(self):
class TestQnwbeta:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_beta_1, cls.w_beta_1 = qnwbeta(n, b, b + 1.0)
cls.x_beta_3, cls.w_beta_3 = qnwbeta(n_3, b_3, b_3 + 1.0)

Expand All @@ -486,7 +486,7 @@ def test_qnwbeta_weights_3d(self):
class TestQnwgamm:

@classmethod
def setup(cls):
def setup_method(cls):
cls.x_gamm_1, cls.w_gamm_1 = qnwgamma(n, b)
cls.x_gamm_3, cls.w_gamm_3 = qnwgamma(n_3, b_3)

Expand Down

0 comments on commit a1b2286

Please sign in to comment.