Skip to content

TST: remove __main__ from all test files #15330

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions pandas/api/tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,3 @@ def test_deprecation_access_obj(self):
with tm.assert_produces_warning(FutureWarning,
check_stacklevel=False):
pd.datetools.monthEnd

if __name__ == '__main__':
import nose
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
5 changes: 0 additions & 5 deletions pandas/computation/tests/test_compat.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,3 @@ def testit():
testit()
else:
testit()


if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
5 changes: 0 additions & 5 deletions pandas/computation/tests/test_eval.py
Original file line number Diff line number Diff line change
Expand Up @@ -1977,8 +1977,3 @@ def test_validate_bool_args(self):
for value in invalid_values:
with self.assertRaises(ValueError):
pd.eval("2+2", inplace=value)


if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
5 changes: 0 additions & 5 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -5762,8 +5762,3 @@ def boxplot(self, column=None, by=None, ax=None, fontsize=None, rot=0,

ops.add_flex_arithmetic_methods(DataFrame, **ops.frame_flex_funcs)
ops.add_special_arithmetic_methods(DataFrame, **ops.frame_special_funcs)

if __name__ == '__main__':
import nose
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
14 changes: 0 additions & 14 deletions pandas/formats/format.py
Original file line number Diff line number Diff line change
Expand Up @@ -2679,17 +2679,3 @@ def _binify(cols, line_width):

bins.append(len(cols))
return bins


if __name__ == '__main__':
arr = np.array([746.03, 0.00, 5620.00, 1592.36])
# arr = np.array([11111111.1, 1.55])
# arr = [314200.0034, 1.4125678]
arr = np.array(
[327763.3119, 345040.9076, 364460.9915, 398226.8688, 383800.5172,
433442.9262, 539415.0568, 568590.4108, 599502.4276, 620921.8593,
620898.5294, 552427.1093, 555221.2193, 519639.7059, 388175.7,
379199.5854, 614898.25, 504833.3333, 560600., 941214.2857, 1134250.,
1219550., 855736.85, 1042615.4286, 722621.3043, 698167.1818, 803750.])
fmt = FloatArrayFormatter(arr, digits=7)
print(fmt.get_result())
7 changes: 0 additions & 7 deletions pandas/io/tests/json/test_normalize.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import nose

from pandas import DataFrame
import numpy as np
import json
Expand Down Expand Up @@ -283,8 +281,3 @@ def test_json_normalize_errors(self):
['general', 'trade_version']],
errors='raise'
)


if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb',
'--pdb-failure', '-s'], exit=False)
5 changes: 0 additions & 5 deletions pandas/io/tests/json/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1044,8 +1044,3 @@ def roundtrip(s, encoding='latin-1'):

for s in examples:
roundtrip(s)


if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb',
'--pdb-failure', '-s'], exit=False)
5 changes: 0 additions & 5 deletions pandas/io/tests/json/test_ujson.py
Original file line number Diff line number Diff line change
Expand Up @@ -1611,8 +1611,3 @@ def test_encodeSet(self):

def _clean_dict(d):
return dict((str(k), v) for k, v in compat.iteritems(d))


if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
4 changes: 0 additions & 4 deletions pandas/io/tests/parser/test_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,3 @@ def test_s3_fails(self):
# It's irrelevant here that this isn't actually a table.
with tm.assertRaises(IOError):
read_csv('s3://cant_get_it/')

if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
5 changes: 0 additions & 5 deletions pandas/io/tests/parser/test_parsers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# -*- coding: utf-8 -*-

import os
import nose

import pandas.util.testing as tm

Expand Down Expand Up @@ -99,7 +98,3 @@ def read_table(self, *args, **kwds):
kwds = kwds.copy()
kwds['engine'] = self.engine
return read_table(*args, **kwds)

if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
5 changes: 0 additions & 5 deletions pandas/io/tests/parser/test_textreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

import os
import sys
import nose

from numpy import nan
import numpy as np
Expand Down Expand Up @@ -402,7 +401,3 @@ def test_empty_csv_input(self):
def assert_array_dicts_equal(left, right):
for k, v in compat.iteritems(left):
assert(np.array_equal(v, right[k]))

if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
6 changes: 0 additions & 6 deletions pandas/io/tests/parser/test_unsupported.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
test suite as new feature support is added to the parsers.
"""

import nose

import pandas.io.parsers as parsers
import pandas.util.testing as tm

Expand Down Expand Up @@ -142,7 +140,3 @@ def test_deprecated_args(self):
kwargs = {arg: non_default_val}
read_csv(StringIO(data), engine=engine,
**kwargs)

if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
6 changes: 0 additions & 6 deletions pandas/io/tests/test_date_converters.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
from pandas.compat import StringIO
from datetime import date, datetime

import nose

import numpy as np

from pandas import DataFrame, MultiIndex
Expand Down Expand Up @@ -150,7 +148,3 @@ def test_parse_date_column_with_empty_string(self):
[621, ' ']]
expected = DataFrame(expected_data, columns=['case', 'opdate'])
assert_frame_equal(result, expected)

if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
5 changes: 0 additions & 5 deletions pandas/io/tests/test_excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -2325,8 +2325,3 @@ def check_called(func):
check_called(lambda: panel.to_excel('something.test'))
check_called(lambda: df.to_excel('something.xlsx'))
check_called(lambda: df.to_excel('something.xls', engine='dummy'))


if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
5 changes: 0 additions & 5 deletions pandas/io/tests/test_feather.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,3 @@ def test_write_with_index(self):
df.index = [0, 1, 2]
df.columns = pd.MultiIndex.from_tuples([('a', 1), ('a', 2), ('b', 1)]),
self.check_error_on_write(df, ValueError)


if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
4 changes: 0 additions & 4 deletions pandas/io/tests/test_gbq.py
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,3 @@ def test_upload_data_as_service_account_with_key_contents(self):
project_id=_get_project_id(),
private_key=_get_private_key_contents())
self.assertEqual(result['NUM_ROWS'][0], test_size)

if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
4 changes: 0 additions & 4 deletions pandas/io/tests/test_html.py
Original file line number Diff line number Diff line change
Expand Up @@ -918,7 +918,3 @@ def test_same_ordering():
dfs_lxml = read_html(filename, index_col=0, flavor=['lxml'])
dfs_bs4 = read_html(filename, index_col=0, flavor=['bs4'])
assert_framelist_equal(dfs_lxml, dfs_bs4)

if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
6 changes: 0 additions & 6 deletions pandas/io/tests/test_pickle.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,3 @@ def test_pickle_v0_15_2(self):
# with open(pickle_path, 'wb') as f: pickle.dump(cat, f)
#
tm.assert_categorical_equal(cat, pd.read_pickle(pickle_path))


if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
# '--with-coverage', '--cover-package=pandas.core'],
exit=False)
6 changes: 0 additions & 6 deletions pandas/io/tests/test_pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -5516,9 +5516,3 @@ def _test_sort(obj):
return obj.reindex(major=sorted(obj.major_axis))
else:
raise ValueError('type not supported here')


if __name__ == '__main__':
import nose
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
6 changes: 1 addition & 5 deletions pandas/io/tests/test_s3.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import nose
from pandas.util import testing as tm

from pandas.io.common import _is_s3_url


class TestS3URL(tm.TestCase):

def test_is_s3_url(self):
self.assertTrue(_is_s3_url("s3://pandas/somethingelse.com"))
self.assertFalse(_is_s3_url("s4://pandas/somethingelse.com"))

if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
5 changes: 0 additions & 5 deletions pandas/io/tests/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -2658,8 +2658,3 @@ def clean_up(test_table_to_drop):
self.assertEqual(tquery(sql_select, con=self.conn),
[(1, 'A'), (2, 'B'), (3, 'C'), (4, 'D'), (5, 'E')])
clean_up(table_name)


if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
5 changes: 0 additions & 5 deletions pandas/io/tests/test_stata.py
Original file line number Diff line number Diff line change
Expand Up @@ -1276,8 +1276,3 @@ def test_out_of_range_float(self):
original.to_stata(path)
tm.assertTrue('ColumnTooBig' in cm.exception)
tm.assertTrue('infinity' in cm.exception)


if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
6 changes: 0 additions & 6 deletions pandas/sparse/tests/test_array.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,9 +810,3 @@ def test_ufunc_args(self):
sparse = SparseArray([1, -1, 0, -2], fill_value=0)
result = SparseArray([2, 0, 1, -1], fill_value=1)
tm.assert_sp_array_equal(np.add(sparse, 1), result)


if __name__ == '__main__':
import nose
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
7 changes: 0 additions & 7 deletions pandas/sparse/tests/test_combine_concat.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# pylint: disable-msg=E1101,W0612

import nose # noqa
import numpy as np
import pandas as pd
import pandas.util.testing as tm
Expand Down Expand Up @@ -356,9 +355,3 @@ def test_concat_sparse_dense(self):
exp = pd.concat([self.dense1, self.dense3], axis=1)
self.assertIsInstance(res, pd.SparseDataFrame)
tm.assert_frame_equal(res, exp)


if __name__ == '__main__':
import nose # noqa
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
5 changes: 0 additions & 5 deletions pandas/sparse/tests/test_frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -1193,8 +1193,3 @@ def test_numpy_func_call(self):
'std', 'min', 'max']
for func in funcs:
getattr(np, func)(self.frame)

if __name__ == '__main__':
import nose
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
10 changes: 2 additions & 8 deletions pandas/sparse/tests/test_libsparse.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pandas import Series

import nose # noqa
import nose
import numpy as np
import operator
import pandas.util.testing as tm
Expand Down Expand Up @@ -196,7 +196,7 @@ def _check_correct(a, b, expected):
assert (result.equals(expected))

def _check_length_exc(a, longer):
nose.tools.assert_raises(Exception, a.intersect, longer)
self.assertRaises(Exception, a.intersect, longer)

def _check_case(xloc, xlen, yloc, ylen, eloc, elen):
xindex = BlockIndex(TEST_LENGTH, xloc, xlen)
Expand Down Expand Up @@ -585,9 +585,3 @@ def f(self):
g = make_optestf(op)
setattr(TestSparseOperators, g.__name__, g)
del g


if __name__ == '__main__':
import nose # noqa
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
6 changes: 0 additions & 6 deletions pandas/sparse/tests/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,3 @@ def test_getitem(self):
for i in range(len(arr)):
tm.assert_almost_equal(splist[i], arr[i])
tm.assert_almost_equal(splist[-i], arr[-i])


if __name__ == '__main__':
import nose
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
6 changes: 0 additions & 6 deletions pandas/sparse/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -1366,9 +1366,3 @@ def test_numpy_func_call(self):
for func in funcs:
for series in ('bseries', 'zbseries'):
getattr(np, func)(getattr(self, series))


if __name__ == '__main__':
import nose
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
5 changes: 0 additions & 5 deletions pandas/stats/tests/test_fama_macbeth.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,3 @@ def _check_stuff_works(self, result):

# does it work?
result.summary

if __name__ == '__main__':
import nose
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
4 changes: 0 additions & 4 deletions pandas/stats/tests/test_math.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,3 @@ def test_inv_illformed(self):
rs = pmath.inv(singular)
expected = np.array([[0.1, 0.2], [0.1, 0.2]])
self.assertTrue(np.allclose(rs, expected))

if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
6 changes: 0 additions & 6 deletions pandas/stats/tests/test_ols.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,9 +974,3 @@ def testFilterWithDictRHS(self):

def tsAssertEqual(self, ts1, ts2, **kwargs):
self.assert_series_equal(ts1, ts2, **kwargs)


if __name__ == '__main__':
import nose
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
5 changes: 0 additions & 5 deletions pandas/stats/tests/test_var.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

from pandas.compat import range
import nose
import unittest

raise nose.SkipTest('skipping this for now')

Expand Down Expand Up @@ -93,7 +92,3 @@ def __init__(self):
self.res1 = VAR2(endog=data).fit(maxlag=2)
from results import results_var
self.res2 = results_var.MacrodataResults()


if __name__ == '__main__':
unittest.main()
5 changes: 0 additions & 5 deletions pandas/tests/formats/test_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -4999,8 +4999,3 @@ def test_format_percentiles():
tm.assertRaises(ValueError, fmt.format_percentiles, [-0.001, 0.1, 0.5])
tm.assertRaises(ValueError, fmt.format_percentiles, [2, 0.1, 0.5])
tm.assertRaises(ValueError, fmt.format_percentiles, [0.1, 0.5, 'a'])


if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
6 changes: 0 additions & 6 deletions pandas/tests/formats/test_printing.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# -*- coding: utf-8 -*-
import nose
from pandas import compat
import pandas.formats.printing as printing
import pandas.formats.format as fmt
Expand Down Expand Up @@ -135,8 +134,3 @@ def test_ambiguous_width(self):
# result = printing.console_encode(u"\u05d0")
# expected = u"\u05d0".encode('utf-8')
# assert (result == expected)


if __name__ == '__main__':
nose.runmodule(argv=[__file__, '-vvs', '-x', '--pdb', '--pdb-failure'],
exit=False)
Loading