Skip to content

Commit 7ffda05

Browse files
authored
Merge pull request statsmodels#5156 from jbrockmendel/nomains
TST: Remove __main__ sections in tests
2 parents 8a1b074 + 274f4e5 commit 7ffda05

32 files changed

+5
-187
lines changed

statsmodels/base/tests/test_data.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -910,8 +910,3 @@ def test_raise_nonfinite_exog():
910910
assert_raises(MissingDataError, OLS, y, x)
911911
x[1, 1] = np.nan
912912
assert_raises(MissingDataError, OLS, y, x)
913-
914-
915-
if __name__ == "__main__":
916-
import pytest
917-
pytest.main([__file__, '-vvs', '-x', '--pdb'])

statsmodels/base/tests/test_shrink_pickle.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -283,19 +283,3 @@ def setup(self):
283283
y_count = np.random.poisson(np.exp(x.sum(1) - x.mean()))
284284
model = sm.Poisson(y_count, x)
285285
self.results = model.fit_regularized(method='l1', disp=0, alpha=10)
286-
287-
288-
if __name__ == '__main__':
289-
for cls in [TestRemoveDataPickleOLS, TestRemoveDataPickleWLS,
290-
TestRemoveDataPicklePoisson,
291-
TestRemoveDataPicklePoissonRegularized,
292-
TestRemoveDataPickleNegativeBinomial,
293-
TestRemoveDataPickleLogit, TestRemoveDataPickleRLM,
294-
TestRemoveDataPickleGLM]:
295-
print(cls)
296-
cls.setup_class()
297-
tt = cls()
298-
tt.setup()
299-
tt.test_remove_data_pickle()
300-
tt.test_remove_data_docstring()
301-
tt.test_pickle_wrapper()

statsmodels/compat/tests/test_itercompat.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,3 @@ def test_combinations():
3434
actual = list(combinations(lrange(4), 3))
3535
desired = [(0, 1, 2), (0, 1, 3), (0, 2, 3), (1, 2, 3)]
3636
assert_(actual == desired, '%r not equal %r' % (actual, desired))
37-
38-
39-
40-
41-
if __name__ == '__main__':
42-
test_zip_longest()
43-
test_combinations()

statsmodels/discrete/tests/test_discrete.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2376,8 +2376,3 @@ def test_unchanging_degrees_of_freedom():
23762376
# Test that the call to `fit_regularized` didn't modify model.df_model inplace.
23772377
assert_equal(res3.df_model, res1.df_model)
23782378
assert_equal(res3.df_resid, res1.df_resid)
2379-
2380-
2381-
if __name__ == "__main__":
2382-
import pytest
2383-
pytest.main([__file__, '-vvs', '-x', '--pdb'])

statsmodels/discrete/tests/test_sandwich_cov.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -722,13 +722,3 @@ def setup_class(cls):
722722
def test_kwd(self):
723723
# test corrected keyword name
724724
assert_allclose(self.res1b.bse, self.res1.bse, rtol=1e-12)
725-
726-
727-
728-
if __name__ == '__main__':
729-
tt = TestPoissonClu()
730-
tt.setup_class()
731-
tt.test_basic()
732-
tt = TestNegbinClu()
733-
tt.setup_class()
734-
tt.test_basic()

statsmodels/distributions/tests/test_discrete.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,3 @@ def test_logpmf(self):
109109
nb_logpmf = nbinom.logpmf(2, n, p)
110110
tnb_logpmf = sm.distributions.zinegbin.logpmf(2, 5, 1, 1, 0.005)
111111
assert_allclose(nb_logpmf, tnb_logpmf, rtol=1e-2, atol=1e-2)
112-
113-
if __name__ == "__main__":
114-
import pytest
115-
pytest.main([__file__, '-vvs', '-x', '--pdb'])

statsmodels/distributions/tests/test_edgeworth.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import numpy as np
66
from numpy.polynomial.hermite_e import HermiteE
7-
from numpy.testing import (run_module_suite, assert_equal, assert_raises,
7+
from numpy.testing import (assert_equal, assert_raises,
88
assert_allclose)
99
import numpy.testing as npt
1010

@@ -188,7 +188,3 @@ def check_distribution_rvs(distfn, args, alpha, rvs):
188188
D,pval = stats.kstest(distfn.rvs, distfn.cdf, args=args, N=1000)
189189
npt.assert_(pval > alpha, "D = " + str(D) + "; pval = " + str(pval) +
190190
"; alpha = " + str(alpha) + "\nargs = " + str(args))
191-
192-
193-
if __name__ == "__main__":
194-
run_module_suite()

statsmodels/distributions/tests/test_mixture.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -103,8 +103,3 @@ def test_mv_mixture_rvs_fixed(self):
103103
[ 3.60521933, 1.57316531, 0.82784584],
104104
[ 3.86102275, 0.6211812 , 1.33016426],
105105
[ 3.91074761, 2.037155 , 2.22247051]]))
106-
107-
108-
if __name__ == "__main__":
109-
import pytest
110-
pytest.main([__file__, '-vvs', '-x', '--pdb'])

statsmodels/duration/tests/test_phreg.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,8 +414,3 @@ def plf(params):
414414
list(itertools.product(fnames, ties, entry_f, strata_f)))
415415
def test_r(fname, ties, entry_f, strata_f):
416416
TestPHReg.do1(fname, ties, entry_f, strata_f)
417-
418-
419-
if __name__ == "__main__":
420-
import pytest
421-
pytest.main([__file__, '-vvs', '-x', '--pdb'])

statsmodels/genmod/families/tests/test_link.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,3 @@ def test_invlogit_stability():
114114
812.2382651982667, 495.06449978924525]
115115
zinv = logit.inverse(z)
116116
assert_equal(zinv, np.ones_like(z))
117-
118-
if __name__=="__main__":
119-
import pytest
120-
pytest.main([__file__, '-vvs', '-x', '--pdb'])

0 commit comments

Comments
 (0)