diff --git a/.travis.yml b/.travis.yml index dd09508e9..4bb58c08b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,8 +10,9 @@ env: - NUMPY_VER=1.16 - CONDA_PREFIX_PATH=$HOME/miniconda3 matrix: - - BUILD_MODE=package TEST_MODE=conda RUN_COVERAGE=False SDC_NP_MPI=1 - - BUILD_MODE=develop TEST_MODE=develop RUN_COVERAGE=True + - BUILD_MODE=package TEST_MODE=conda RUN_COVERAGE=False SDC_CONFIG_PIPELINE_SDC=True + - BUILD_MODE=package TEST_MODE=conda RUN_COVERAGE=False SDC_CONFIG_PIPELINE_SDC=True SDC_NP_MPI=1 + - BUILD_MODE=develop TEST_MODE=develop RUN_COVERAGE=True SDC_CONFIG_PIPELINE_SDC=True before_install: - chmod 777 buildscripts/install_conda.sh diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 51b1304c2..2106b03ad 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,6 +9,7 @@ jobs: PYTHON_VER: '3.7' NUMPY_VER: '1.16' USE_NUMBA_MASTER: 'False' + SDC_CONFIG_PIPELINE_SDC: 'False' - template: buildscripts/azure/template-linux-macos.yml parameters: @@ -20,6 +21,7 @@ jobs: PYTHON_VER: '3.7' NUMPY_VER: '1.16' USE_NUMBA_MASTER: 'False' + SDC_CONFIG_PIPELINE_SDC: 'False' - template: buildscripts/azure/template-linux-macos.yml parameters: @@ -31,6 +33,7 @@ jobs: PYTHON_VER: '3.7' NUMPY_VER: '1.16' USE_NUMBA_MASTER: 'False' + SDC_CONFIG_PIPELINE_SDC: 'False' - template: buildscripts/azure/template-windows.yml parameters: @@ -42,6 +45,7 @@ jobs: PYTHON_VER: '3.7' NUMPY_VER: '1.16' USE_NUMBA_MASTER: 'True' + SDC_CONFIG_PIPELINE_SDC: 'False' - template: buildscripts/azure/template-linux-macos.yml parameters: @@ -53,6 +57,7 @@ jobs: PYTHON_VER: '3.7' NUMPY_VER: '1.16' USE_NUMBA_MASTER: 'True' + SDC_CONFIG_PIPELINE_SDC: 'False' - template: buildscripts/azure/template-linux-macos.yml parameters: @@ -63,4 +68,5 @@ jobs: py3.7_numpy1.16: PYTHON_VER: '3.7' NUMPY_VER: '1.16' - USE_NUMBA_MASTER: 'True' \ No newline at end of file + USE_NUMBA_MASTER: 'True' + SDC_CONFIG_PIPELINE_SDC: 'False' diff --git a/buildscripts/azure/template-linux-macos.yml b/buildscripts/azure/template-linux-macos.yml index 5fa631a56..4c16fa7b9 100644 --- a/buildscripts/azure/template-linux-macos.yml +++ b/buildscripts/azure/template-linux-macos.yml @@ -22,7 +22,7 @@ jobs: - script: | if [ "$USE_NUMBA_MASTER" == "False" ]; then - $HOME/miniconda3/bin/python buildscripts/build.py --build-mode=package --python=$PYTHON_VER --numpy=$NUMPY_VER --conda-prefix=$HOME/miniconda3; + $HOME/miniconda3/bin/python buildscripts/build.py --build-mode=package --python=$PYTHON_VER --numpy=$NUMPY_VER --skip-smoke-tests --conda-prefix=$HOME/miniconda3; else $HOME/miniconda3/bin/python buildscripts/build.py --build-mode=package --python=$PYTHON_VER --numpy=$NUMPY_VER --use-numba-master --conda-prefix=$HOME/miniconda3; fi diff --git a/buildscripts/azure/template-windows.yml b/buildscripts/azure/template-windows.yml index c218c9bb4..b77464eb3 100644 --- a/buildscripts/azure/template-windows.yml +++ b/buildscripts/azure/template-windows.yml @@ -21,7 +21,7 @@ jobs: - script: | IF "%USE_NUMBA_MASTER%" == "False" ( - "C:\\Miniconda\\python.exe" buildscripts\\build.py --build-mode=package --python=%PYTHON_VER% --numpy=%NUMPY_VER% --conda-prefix="C:\\Miniconda" + "C:\\Miniconda\\python.exe" buildscripts\\build.py --build-mode=package --python=%PYTHON_VER% --numpy=%NUMPY_VER% --skip-smoke-tests --conda-prefix="C:\\Miniconda" ) ELSE ( "C:\\Miniconda\\python.exe" buildscripts\\build.py --build-mode=package --python=%PYTHON_VER% --numpy=%NUMPY_VER% --use-numba-master --conda-prefix="C:\\Miniconda") displayName: 'Build conda and wheel packages' diff --git a/sdc/tests/test_basic.py b/sdc/tests/test_basic.py index d89df5012..f07a272c6 100644 --- a/sdc/tests/test_basic.py +++ b/sdc/tests/test_basic.py @@ -37,7 +37,8 @@ import sdc from sdc.tests.test_utils import (count_array_REPs, count_parfor_REPs, count_parfor_OneDs, count_array_OneDs, count_array_OneD_Vars, - dist_IR_contains, get_rank, get_start_end, check_numba_version) + dist_IR_contains, get_rank, get_start_end, check_numba_version, + skip_numba_jit, TestCase) def get_np_state_ptr(): @@ -54,7 +55,7 @@ def _copy_py_state(r, ptr): return ints, index -class BaseTest(unittest.TestCase): +class BaseTest(TestCase): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) @@ -214,6 +215,7 @@ def f(): hpat_f = sdc.jit(f) hpat_f() + @skip_numba_jit def test_inline_locals(self): # make sure locals in inlined function works @sdc.jit(locals={'B': types.float64[:]}) @@ -250,6 +252,7 @@ def test_reduce(self): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_reduce2(self): import sys dtypes = ['float32', 'float64', 'int32', 'int64'] @@ -277,6 +280,7 @@ def test_reduce2(self): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_reduce_filter1(self): import sys dtypes = ['float32', 'float64', 'int32', 'int64'] @@ -306,6 +310,7 @@ def test_reduce_filter1(self): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_array_reduce(self): binops = ['+=', '*=', '+=', '*=', '|=', '|='] dtypes = ['np.float32', 'np.float32', 'np.float64', 'np.float64', 'np.int32', 'np.int64'] @@ -365,6 +370,7 @@ def test_impl(N): self.assertEqual(count_array_OneDs(), 2) self.assertEqual(count_parfor_OneDs(), 2) + @skip_numba_jit def test_dist_input(self): def test_impl(A): return len(A) diff --git a/sdc/tests/test_d4p.py b/sdc/tests/test_d4p.py index 9d85f191d..80ea4faac 100644 --- a/sdc/tests/test_d4p.py +++ b/sdc/tests/test_d4p.py @@ -39,9 +39,10 @@ from sdc.tests.test_utils import (count_array_REPs, count_parfor_REPs, count_parfor_OneDs, count_array_OneDs, count_parfor_OneD_Vars, count_array_OneD_Vars, - dist_IR_contains) + dist_IR_contains, + TestCase) - class TestD4P(unittest.TestCase): + class TestD4P(TestCase): def test_logistic_regression(self): ''' Testing logistic regression including diff --git a/sdc/tests/test_dataframe.py b/sdc/tests/test_dataframe.py index cf9ab680f..a3bc3c51a 100644 --- a/sdc/tests/test_dataframe.py +++ b/sdc/tests/test_dataframe.py @@ -36,7 +36,8 @@ import numba import sdc from sdc.tests.test_utils import (count_array_REPs, count_parfor_REPs, count_parfor_OneDs, - count_array_OneDs, dist_IR_contains, get_start_end, check_numba_version) + count_array_OneDs, dist_IR_contains, get_start_end, check_numba_version, + skip_numba_jit, TestCase) from sdc.tests.gen_test_data import ParquetGenerator from numba.config import IS_32BITS @@ -52,7 +53,7 @@ def inner_get_column(df): COL_IND = 0 -class TestDataFrame(unittest.TestCase): +class TestDataFrame(TestCase): def test_create1(self): def test_impl(n): @@ -149,6 +150,7 @@ def test_impl(df): df = pd.DataFrame({'A': ['aa', 'bb', 'cc']}) pd.testing.assert_frame_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_box_categorical(self): def test_impl(df): df['A'] = df['A'] + 1 @@ -201,6 +203,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_column_getitem1(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n), 'B': np.random.ranf(n)}) @@ -224,6 +227,7 @@ def test_impl(df): {'A': np.arange(n), 'B': np.ones(n), 'C': np.random.ranf(n)}) pd.testing.assert_frame_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_filter1(self): def test_impl(n): df = pd.DataFrame({'A': np.arange(n) + n, 'B': np.arange(n)**2}) @@ -236,6 +240,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_filter2(self): def test_impl(n): df = pd.DataFrame({'A': np.arange(n) + n, 'B': np.arange(n)**2}) @@ -248,6 +253,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_filter3(self): def test_impl(n): df = pd.DataFrame({'A': np.arange(n) + n, 'B': np.arange(n)**2}) @@ -260,6 +266,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_iloc1(self): def test_impl(df, n): return df.iloc[1:n].B.values @@ -269,6 +276,7 @@ def test_impl(df, n): df = pd.DataFrame({'A': np.arange(n), 'B': np.arange(n)**2}) np.testing.assert_array_equal(hpat_func(df, n), test_impl(df, n)) + @skip_numba_jit def test_iloc2(self): def test_impl(df, n): return df.iloc[np.array([1, 4, 9])].B.values @@ -424,6 +432,7 @@ def test_impl(df, n): do_check = False if platform.system() == 'Windows' and not IS_32BITS else True pd.testing.assert_frame_equal(df1, df2, check_dtype=do_check) + @skip_numba_jit def test_set_column_bool1(self): def test_impl(df): df['C'] = df['A'][df['B']] @@ -489,6 +498,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_df_apply(self): def test_impl(n): df = pd.DataFrame({'A': np.arange(n), 'B': np.arange(n)}) @@ -499,6 +509,7 @@ def test_impl(n): hpat_func = sdc.jit(test_impl) np.testing.assert_almost_equal(hpat_func(n), test_impl(n)) + @skip_numba_jit def test_df_apply_branch(self): def test_impl(n): df = pd.DataFrame({'A': np.arange(n), 'B': np.arange(n)}) @@ -523,6 +534,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_sort_values(self): def test_impl(df): df.sort_values('A', inplace=True) @@ -534,6 +546,7 @@ def test_impl(df): hpat_func = sdc.jit(test_impl) np.testing.assert_almost_equal(hpat_func(df.copy()), test_impl(df)) + @skip_numba_jit def test_sort_values_copy(self): def test_impl(df): df2 = df.sort_values('A') @@ -545,6 +558,7 @@ def test_impl(df): hpat_func = sdc.jit(test_impl) np.testing.assert_almost_equal(hpat_func(df.copy()), test_impl(df)) + @skip_numba_jit def test_sort_values_single_col(self): def test_impl(df): df.sort_values('A', inplace=True) @@ -556,6 +570,7 @@ def test_impl(df): hpat_func = sdc.jit(test_impl) np.testing.assert_almost_equal(hpat_func(df.copy()), test_impl(df)) + @skip_numba_jit def test_sort_values_single_col_str(self): def test_impl(df): df.sort_values('A', inplace=True) @@ -573,6 +588,7 @@ def test_impl(df): hpat_func = sdc.jit(test_impl) self.assertTrue((hpat_func(df.copy()) == test_impl(df)).all()) + @skip_numba_jit def test_sort_values_str(self): def test_impl(df): df.sort_values('A', inplace=True) @@ -596,6 +612,7 @@ def test_impl(df): hpat_func = sdc.jit(test_impl) self.assertTrue((hpat_func(df) == sorted_df.B.values).all()) + @skip_numba_jit def test_sort_parallel_single_col(self): # create `kde.parquet` file ParquetGenerator.gen_kde_pq() @@ -671,6 +688,7 @@ def test_impl(df): }) pd.testing.assert_frame_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_sort_parallel(self): # create `kde.parquet` file ParquetGenerator.gen_kde_pq() @@ -730,6 +748,7 @@ def test_impl(n): n = 11 self.assertEqual(hpat_func(n), test_impl(n)) + @skip_numba_jit def test_itertuples_analysis(self): """tests array analysis handling of generated tuples, shapes going through blocks and getting used in an array dimension @@ -757,6 +776,7 @@ def test_impl(n): n = 11 pd.testing.assert_frame_equal(hpat_func(n), test_impl(n)) + @skip_numba_jit def test_pct_change1(self): def test_impl(n): df = pd.DataFrame({'A': np.arange(n) + 1.0, 'B': np.arange(n) + 1}) @@ -909,6 +929,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) pd.testing.assert_frame_equal(hpat_func(), test_impl()) + @skip_numba_jit def test_df_dropna1(self): def test_impl(df): return df.dropna() @@ -919,6 +940,7 @@ def test_impl(df): h_out = hpat_func(df) pd.testing.assert_frame_equal(out, h_out) + @skip_numba_jit def test_df_dropna2(self): def test_impl(df): return df.dropna() @@ -929,6 +951,7 @@ def test_impl(df): h_out = hpat_func(df) pd.testing.assert_frame_equal(out, h_out) + @skip_numba_jit def test_df_dropna_inplace1(self): # TODO: fix error when no df is returned def test_impl(df): @@ -942,6 +965,7 @@ def test_impl(df): h_out = hpat_func(df2) pd.testing.assert_frame_equal(out, h_out) + @skip_numba_jit def test_df_dropna_str1(self): def test_impl(df): return df.dropna() @@ -952,6 +976,7 @@ def test_impl(df): h_out = hpat_func(df) pd.testing.assert_frame_equal(out, h_out) + @skip_numba_jit def test_df_drop1(self): def test_impl(df): return df.drop(columns=['A']) @@ -960,6 +985,7 @@ def test_impl(df): hpat_func = sdc.jit(test_impl) pd.testing.assert_frame_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_df_drop_inplace2(self): # test droping after setting the column def test_impl(df): @@ -1014,6 +1040,7 @@ def test_impl(df): df = pd.DataFrame({'A': np.arange(n), 'B': np.arange(n)**2}) pd.testing.assert_frame_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_append1(self): def test_impl(df, df2): return df.append(df2, ignore_index=True) @@ -1025,6 +1052,7 @@ def test_impl(df, df2): df2.A[n // 2:] = n pd.testing.assert_frame_equal(hpat_func(df, df2), test_impl(df, df2)) + @skip_numba_jit def test_append2(self): def test_impl(df, df2, df3): return df.append([df2, df3], ignore_index=True) @@ -1038,6 +1066,7 @@ def test_impl(df, df2, df3): pd.testing.assert_frame_equal( hpat_func(df, df2, df3), test_impl(df, df2, df3)) + @skip_numba_jit def test_concat_columns1(self): def test_impl(S1, S2): return pd.concat([S1, S2], axis=1) diff --git a/sdc/tests/test_date.py b/sdc/tests/test_date.py index 48b4c2a71..7bb26a1cc 100644 --- a/sdc/tests/test_date.py +++ b/sdc/tests/test_date.py @@ -34,12 +34,13 @@ from sdc.tests.test_utils import (count_array_REPs, count_parfor_REPs, count_parfor_OneDs, count_array_OneDs, count_parfor_OneD_Vars, count_array_OneD_Vars, - dist_IR_contains) + dist_IR_contains, + skip_numba_jit, TestCase) from datetime import datetime import random -class TestDate(unittest.TestCase): +class TestDate(TestCase): @unittest.skip("needs support for boxing/unboxing DatetimeIndex") def test_datetime_index_in(self): def test_impl(dti): @@ -50,6 +51,7 @@ def test_impl(dti): dti = pd.DatetimeIndex(df['str_date']) np.testing.assert_array_equal(hpat_func(dti).values, test_impl(dti).values) + @skip_numba_jit def test_datetime_index(self): def test_impl(df): return pd.DatetimeIndex(df['str_date']).values @@ -58,6 +60,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_kw(self): def test_impl(df): return pd.DatetimeIndex(data=df['str_date']).values @@ -75,6 +78,7 @@ def test_impl(A): A = pd.DatetimeIndex(df['str_date']).to_series() np.testing.assert_array_equal(hpat_func(A), test_impl(A)) + @skip_numba_jit def test_datetime_getitem(self): def test_impl(A): return A[0] @@ -84,6 +88,7 @@ def test_impl(A): A = pd.DatetimeIndex(df['str_date']).to_series() self.assertEqual(hpat_func(A), test_impl(A)) + @skip_numba_jit def test_ts_map(self): def test_impl(A): return A.map(lambda x: x.hour) @@ -93,6 +98,7 @@ def test_impl(A): A = pd.DatetimeIndex(df['str_date']).to_series() np.testing.assert_array_equal(hpat_func(A), test_impl(A)) + @skip_numba_jit def test_ts_map_date(self): def test_impl(A): return A.map(lambda x: x.date())[0] @@ -102,6 +108,7 @@ def test_impl(A): A = pd.DatetimeIndex(df['str_date']).to_series() np.testing.assert_array_equal(hpat_func(A), test_impl(A)) + @skip_numba_jit def test_ts_map_date2(self): def test_impl(df): return df.apply(lambda row: row.dt_ind.date(), axis=1)[0] @@ -111,6 +118,7 @@ def test_impl(df): df['dt_ind'] = pd.DatetimeIndex(df['str_date']) np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_ts_map_date_set(self): def test_impl(df): df['hpat_date'] = df.dt_ind.map(lambda x: x.date()) @@ -122,6 +130,7 @@ def test_impl(df): df['pd_date'] = df.dt_ind.map(lambda x: x.date()) np.testing.assert_array_equal(df['hpat_date'], df['pd_date']) + @skip_numba_jit def test_date_series_unbox(self): def test_impl(A): return A[0] @@ -131,6 +140,7 @@ def test_impl(A): A = pd.DatetimeIndex(df['str_date']).to_series().map(lambda x: x.date()) self.assertEqual(hpat_func(A), test_impl(A)) + @skip_numba_jit def test_date_series_unbox2(self): def test_impl(A): return A[0] @@ -140,6 +150,7 @@ def test_impl(A): A = pd.DatetimeIndex(df['str_date']).map(lambda x: x.date()) self.assertEqual(hpat_func(A), test_impl(A)) + @skip_numba_jit def test_datetime_index_set(self): def test_impl(df): df['sdc'] = pd.DatetimeIndex(df['str_date']).values @@ -177,6 +188,7 @@ def test_impl(s): ts = pd.Timestamp(datetime(2017, 4, 26).isoformat()) self.assertEqual(hpat_func(ts), test_impl(ts)) + @skip_numba_jit def test_datetimeindex_str_comp(self): def test_impl(df): return (df.A >= '2011-10-23').values @@ -185,6 +197,7 @@ def test_impl(df): hpat_func = sdc.jit(test_impl) np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetimeindex_str_comp2(self): def test_impl(df): return ('2011-10-23' <= df.A).values @@ -193,6 +206,7 @@ def test_impl(df): hpat_func = sdc.jit(test_impl) np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_df(self): def test_impl(df): df = pd.DataFrame({'A': pd.DatetimeIndex(df['str_date'])}) @@ -202,6 +216,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_date(self): def test_impl(df): return pd.DatetimeIndex(df['str_date']).date @@ -210,6 +225,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_max(self): def test_impl(df): return pd.DatetimeIndex(df['str_date']).max() @@ -218,6 +234,7 @@ def test_impl(df): df = self._gen_str_date_df() self.assertEqual(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_min(self): def test_impl(df): return pd.DatetimeIndex(df['str_date']).min() @@ -226,6 +243,7 @@ def test_impl(df): df = self._gen_str_date_df() self.assertEqual(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_timedelta_days(self): def test_impl(df): s = pd.DatetimeIndex(df['str_date']) @@ -236,6 +254,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_timedelta_seconds(self): def test_impl(df): s = pd.DatetimeIndex(df['str_date']) @@ -246,6 +265,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_timedelta_microseconds(self): def test_impl(df): s = pd.DatetimeIndex(df['str_date']) @@ -256,6 +276,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_timedelta_nanoseconds(self): def test_impl(df): s = pd.DatetimeIndex(df['str_date']) @@ -266,6 +287,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_ret(self): def test_impl(df): return pd.DatetimeIndex(df['str_date']) @@ -275,6 +297,7 @@ def test_impl(df): pd.testing.assert_index_equal(hpat_func(df), test_impl(df), check_names=False) + @skip_numba_jit def test_datetime_index_year(self): def test_impl(df): return pd.DatetimeIndex(df['str_date']).year @@ -283,6 +306,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_month(self): def test_impl(df): return pd.DatetimeIndex(df['str_date']).month @@ -291,6 +315,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_day(self): def test_impl(df): return pd.DatetimeIndex(df['str_date']).day @@ -299,6 +324,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_hour(self): def test_impl(df): return pd.DatetimeIndex(df['str_date']).hour @@ -307,6 +333,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_minute(self): def test_impl(df): return pd.DatetimeIndex(df['str_date']).minute @@ -315,6 +342,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_second(self): def test_impl(df): return pd.DatetimeIndex(df['str_date']).second @@ -323,6 +351,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_microsecond(self): def test_impl(df): return pd.DatetimeIndex(df['str_date']).microsecond @@ -331,6 +360,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_index_nanosecond(self): def test_impl(df): return pd.DatetimeIndex(df['str_date']).nanosecond @@ -339,6 +369,7 @@ def test_impl(df): df = self._gen_str_date_df() np.testing.assert_array_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_datetime_series_dt_date(self): def test_impl(A): return A.dt.date @@ -351,6 +382,7 @@ def test_impl(A): hpat_func(A), test_impl(A).reset_index(drop=True), check_names=False) + @skip_numba_jit def test_datetime_series_dt_year(self): def test_impl(A): return A.dt.year diff --git a/sdc/tests/test_groupby.py b/sdc/tests/test_groupby.py index aa3bd0733..a3c87fbf4 100644 --- a/sdc/tests/test_groupby.py +++ b/sdc/tests/test_groupby.py @@ -33,7 +33,8 @@ import sdc from sdc.tests.test_utils import (count_array_REPs, count_parfor_REPs, count_parfor_OneDs, count_array_OneDs, dist_IR_contains, - get_start_end) + get_start_end, + skip_numba_jit, TestCase) _pivot_df1 = pd.DataFrame({"A": ["foo", "foo", "foo", "foo", "foo", @@ -46,7 +47,8 @@ "D": [1, 2, 2, 6, 3, 4, 5, 6, 9]}) -class TestGroupBy(unittest.TestCase): +class TestGroupBy(TestCase): + @skip_numba_jit def test_agg_seq(self): def test_impl(df): A = df.groupby('A')['B'].agg(lambda x: x.max() - x.min()) @@ -57,6 +59,7 @@ def test_impl(df): # np.testing.assert_array_equal(hpat_func(df), test_impl(df)) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_seq_sum(self): def test_impl(df): A = df.groupby('A')['B'].sum() @@ -66,6 +69,7 @@ def test_impl(df): df = pd.DataFrame({'A': [2, 1, 1, 1, 2, 2, 1], 'B': [-8, 2, 3, 1, 5, 6, 7]}) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_seq_count(self): def test_impl(df): A = df.groupby('A')['B'].count() @@ -75,6 +79,7 @@ def test_impl(df): df = pd.DataFrame({'A': [2, 1, 1, 1, 2, 2, 1], 'B': [-8, 2, 3, 1, 5, 6, 7]}) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_seq_mean(self): def test_impl(df): A = df.groupby('A')['B'].mean() @@ -84,6 +89,7 @@ def test_impl(df): df = pd.DataFrame({'A': [2, 1, 1, 1, 2, 2, 1], 'B': [-8, 2, 3, 1, 5, 6, 7]}) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_seq_min(self): def test_impl(df): A = df.groupby('A')['B'].min() @@ -93,6 +99,7 @@ def test_impl(df): df = pd.DataFrame({'A': [2, 1, 1, 1, 2, 2, 1], 'B': [-8, 2, 3, 1, 5, 6, 7]}) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_seq_min_date(self): def test_impl(df): df2 = df.groupby('A', as_index=False).min() @@ -102,6 +109,7 @@ def test_impl(df): df = pd.DataFrame({'A': [2, 1, 1, 1, 2, 2, 1], 'B': pd.date_range('2019-1-3', '2019-1-9')}) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_seq_max(self): def test_impl(df): A = df.groupby('A')['B'].max() @@ -111,6 +119,7 @@ def test_impl(df): df = pd.DataFrame({'A': [2, 1, 1, 1, 2, 2, 1], 'B': [-8, 2, 3, 1, 5, 6, 7]}) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_seq_all_col(self): def test_impl(df): df2 = df.groupby('A').mean() @@ -120,6 +129,7 @@ def test_impl(df): df = pd.DataFrame({'A': [2, 1, 1, 1, 2, 2, 1], 'B': [-8, 2, 3, 1, 5, 6, 7]}) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_seq_as_index(self): def test_impl(df): df2 = df.groupby('A', as_index=False).mean() @@ -129,6 +139,7 @@ def test_impl(df): df = pd.DataFrame({'A': [2, 1, 1, 1, 2, 2, 1], 'B': [-8, 2, 3, 1, 5, 6, 7]}) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_seq_prod(self): def test_impl(df): A = df.groupby('A')['B'].prod() @@ -138,6 +149,7 @@ def test_impl(df): df = pd.DataFrame({'A': [2, 1, 1, 1, 2, 2, 1], 'B': [-8, 2, 3, 1, 5, 6, 7]}) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_seq_var(self): def test_impl(df): A = df.groupby('A')['B'].var() @@ -147,6 +159,7 @@ def test_impl(df): df = pd.DataFrame({'A': [2, 1, 1, 1, 2, 2, 1], 'B': [-8, 2, 3, 1, 5, 6, 7]}) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_seq_std(self): def test_impl(df): A = df.groupby('A')['B'].std() @@ -156,6 +169,7 @@ def test_impl(df): df = pd.DataFrame({'A': [2, 1, 1, 1, 2, 2, 1], 'B': [-8, 2, 3, 1, 5, 6, 7]}) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_seq_multiselect(self): def test_impl(df): df2 = df.groupby('A')['B', 'C'].sum() @@ -166,6 +180,7 @@ def test_impl(df): 'C': [3, 5, 6, 5, 4, 4, 3]}) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_multikey_seq(self): def test_impl(df): A = df.groupby(['A', 'C'])['B'].sum() @@ -176,6 +191,7 @@ def test_impl(df): 'C': [3, 5, 6, 5, 4, 4, 3]}) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_multikey_parallel(self): def test_impl(in_A, in_B, in_C): df = pd.DataFrame({'A': in_A, 'B': in_B, 'C': in_C}) @@ -198,6 +214,7 @@ def test_impl(in_A, in_B, in_C): p_res = test_impl(p_A, p_B, p_C) self.assertEqual(h_res, p_res) + @skip_numba_jit def test_agg_parallel(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n, np.int64), 'B': np.arange(n)}) @@ -210,6 +227,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_agg_parallel_sum(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n, np.int64), 'B': np.arange(n)}) @@ -222,6 +240,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_agg_parallel_count(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n, np.int64), 'B': np.arange(n)}) @@ -234,6 +253,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_agg_parallel_mean(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n, np.int64), 'B': np.arange(n)}) @@ -246,6 +266,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_agg_parallel_min(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n, np.int64), 'B': np.arange(n)}) @@ -258,6 +279,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_agg_parallel_max(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n, np.int64), 'B': np.arange(n)}) @@ -270,6 +292,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_agg_parallel_var(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n, np.int64), 'B': np.arange(n)}) @@ -282,6 +305,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_agg_parallel_std(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n, np.int64), 'B': np.arange(n)}) @@ -307,6 +331,7 @@ def test_impl(): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_agg_parallel_all_col(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n, np.int64), 'B': np.arange(n)}) @@ -319,6 +344,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_agg_parallel_as_index(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n, np.int64), 'B': np.arange(n)}) @@ -331,6 +357,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_muti_hiframes_node_filter_agg(self): def test_impl(df, cond): df2 = df[cond] @@ -345,6 +372,7 @@ def test_impl(df, cond): self.assertEqual(set(res[1]), set(h_res[1])) np.testing.assert_array_equal(res[0], h_res[0]) + @skip_numba_jit def test_agg_seq_str(self): def test_impl(df): A = df.groupby('A')['B'].agg(lambda x: (x == 'aa').sum()) @@ -356,6 +384,7 @@ def test_impl(df): # np.testing.assert_array_equal(hpat_func(df), test_impl(df)) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_agg_seq_count_str(self): def test_impl(df): A = df.groupby('A')['B'].count() @@ -367,6 +396,7 @@ def test_impl(df): # np.testing.assert_array_equal(hpat_func(df), test_impl(df)) self.assertEqual(set(hpat_func(df)), set(test_impl(df))) + @skip_numba_jit def test_pivot(self): def test_impl(df): pt = df.pivot_table(index='A', columns='C', values='D', aggfunc='sum') @@ -378,6 +408,7 @@ def test_impl(df): self.assertEqual( set(hpat_func(_pivot_df1)[1]), set(test_impl(_pivot_df1)[1])) + @skip_numba_jit def test_pivot_parallel(self): def test_impl(): df = pd.read_parquet("pivot2.pq") @@ -389,6 +420,7 @@ def test_impl(): pivots={'pt': ['small', 'large']})(test_impl) self.assertEqual(hpat_func(), test_impl()) + @skip_numba_jit def test_crosstab1(self): def test_impl(df): pt = pd.crosstab(df.A, df.C) @@ -400,6 +432,7 @@ def test_impl(df): self.assertEqual( set(hpat_func(_pivot_df1)[1]), set(test_impl(_pivot_df1)[1])) + @skip_numba_jit def test_crosstab_parallel1(self): def test_impl(): df = pd.read_parquet("pivot2.pq") diff --git a/sdc/tests/test_hiframes.py b/sdc/tests/test_hiframes.py index f36bb71b9..10d9c9096 100644 --- a/sdc/tests/test_hiframes.py +++ b/sdc/tests/test_hiframes.py @@ -42,11 +42,13 @@ from sdc.str_arr_ext import StringArray from sdc.tests.test_utils import (count_array_REPs, count_parfor_REPs, count_parfor_OneDs, count_array_OneDs, dist_IR_contains, - get_start_end) + get_start_end, + skip_numba_jit, TestCase) -class TestHiFrames(unittest.TestCase): +class TestHiFrames(TestCase): + @skip_numba_jit def test_column_list_select2(self): # make sure SDC copies the columns like Pandas does def test_impl(df): @@ -60,6 +62,7 @@ def test_impl(df): {'A': np.arange(n), 'B': np.ones(n), 'C': np.random.ranf(n)}) np.testing.assert_array_equal(hpat_func(df.copy())[1], test_impl(df)[1]) + @skip_numba_jit def test_pd_DataFrame_from_series_par(self): def test_impl(n): S1 = pd.Series(np.ones(n)) @@ -74,6 +77,7 @@ def test_impl(n): self.assertEqual(count_parfor_REPs(), 0) self.assertEqual(count_parfor_OneDs(), 1) + @skip_numba_jit def test_getitem_bool_series(self): def test_impl(df): return df['A'][df['B']].values @@ -134,6 +138,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) np.testing.assert_almost_equal(hpat_func(), test_impl()) + @skip_numba_jit def test_column_map(self): def test_impl(n): df = pd.DataFrame({'A': np.arange(n)}) @@ -144,6 +149,7 @@ def test_impl(n): hpat_func = sdc.jit(test_impl) np.testing.assert_almost_equal(hpat_func(n), test_impl(n)) + @skip_numba_jit def test_column_map_arg(self): def test_impl(df): df['B'] = df.A.map(lambda a: 2 * a) @@ -158,6 +164,7 @@ def test_impl(df): test_impl(df2) np.testing.assert_equal(df1.B.values, df2.B.values) + @skip_numba_jit def test_cumsum(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n), 'B': np.random.ranf(n)}) @@ -173,6 +180,7 @@ def test_impl(n): self.assertEqual(count_parfor_OneDs(), 2) self.assertTrue(dist_IR_contains('dist_cumsum')) + @skip_numba_jit def test_column_distribution(self): # make sure all column calls are distributed def test_impl(n): @@ -244,6 +252,7 @@ def test_impl(A): A = np.arange(0, n, 1, np.float64) np.testing.assert_almost_equal(hpat_func(A), test_impl(A)) + @skip_numba_jit def test_nunique(self): def test_impl(n): df = pd.DataFrame({'A': np.arange(n)}) @@ -257,6 +266,7 @@ def test_impl(n): hpat_func = sdc.jit(test_impl) np.testing.assert_almost_equal(hpat_func(n), test_impl(n)) + @skip_numba_jit def test_nunique_parallel(self): # TODO: test without file def test_impl(): @@ -299,6 +309,7 @@ def test_impl(): self.assertEqual(hpat_func(), test_impl()) self.assertEqual(count_array_REPs(), 0) + @skip_numba_jit def test_unique_parallel(self): # TODO: test without file def test_impl(): @@ -321,6 +332,7 @@ def test_impl(): self.assertEqual(hpat_func(), test_impl()) self.assertEqual(count_array_REPs(), 0) + @skip_numba_jit def test_describe(self): def test_impl(n): df = pd.DataFrame({'A': np.arange(0, n, 1, np.float64)}) @@ -333,6 +345,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_str_contains_regex(self): def test_impl(): A = StringArray(['ABC', 'BB', 'ADEF']) @@ -343,6 +356,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) self.assertEqual(hpat_func(), 2) + @skip_numba_jit def test_str_contains_noregex(self): def test_impl(): A = StringArray(['ABC', 'BB', 'ADEF']) @@ -353,6 +367,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) self.assertEqual(hpat_func(), 1) + @skip_numba_jit def test_str_replace_regex(self): def test_impl(df): return df.A.str.replace('AB*', 'EE', regex=True) @@ -362,6 +377,7 @@ def test_impl(df): pd.testing.assert_series_equal( hpat_func(df), test_impl(df), check_names=False) + @skip_numba_jit def test_str_replace_noregex(self): def test_impl(df): return df.A.str.replace('AB', 'EE', regex=False) @@ -371,6 +387,7 @@ def test_impl(df): pd.testing.assert_series_equal( hpat_func(df), test_impl(df), check_names=False) + @skip_numba_jit def test_str_replace_regex_parallel(self): def test_impl(df): B = df.A.str.replace('AB*', 'EE', regex=True) @@ -386,6 +403,7 @@ def test_impl(df): self.assertEqual(count_array_REPs(), 3) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_str_split(self): def test_impl(df): return df.A.str.split(',') @@ -395,6 +413,7 @@ def test_impl(df): pd.testing.assert_series_equal( hpat_func(df), test_impl(df), check_names=False) + @skip_numba_jit def test_str_split_default(self): def test_impl(df): return df.A.str.split() @@ -404,6 +423,7 @@ def test_impl(df): pd.testing.assert_series_equal( hpat_func(df), test_impl(df), check_names=False) + @skip_numba_jit def test_str_split_filter(self): def test_impl(df): B = df.A.str.split(',') @@ -415,6 +435,7 @@ def test_impl(df): pd.testing.assert_frame_equal( hpat_func(df), test_impl(df).reset_index(drop=True)) + @skip_numba_jit def test_str_split_box_df(self): def test_impl(df): return pd.DataFrame({'B': df.A.str.split(',')}) @@ -424,6 +445,7 @@ def test_impl(df): pd.testing.assert_series_equal( hpat_func(df).B, test_impl(df).B, check_names=False) + @skip_numba_jit def test_str_split_unbox_df(self): def test_impl(df): return df.A.iloc[0] @@ -433,6 +455,7 @@ def test_impl(df): hpat_func = sdc.jit(test_impl) self.assertEqual(hpat_func(df2), test_impl(df2)) + @skip_numba_jit def test_str_split_bool_index(self): def test_impl(df): C = df.A.str.split(',') @@ -443,6 +466,7 @@ def test_impl(df): pd.testing.assert_series_equal( hpat_func(df), test_impl(df), check_names=False) + @skip_numba_jit def test_str_split_parallel(self): def test_impl(df): B = df.A.str.split(',') @@ -458,6 +482,7 @@ def test_impl(df): self.assertEqual(count_array_REPs(), 3) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_str_get(self): def test_impl(df): B = df.A.str.split(',') @@ -468,6 +493,7 @@ def test_impl(df): pd.testing.assert_series_equal( hpat_func(df), test_impl(df), check_names=False) + @skip_numba_jit def test_str_split(self): def test_impl(df): return df.A.str.split(',') @@ -476,6 +502,7 @@ def test_impl(df): hpat_func = sdc.jit(test_impl) pd.testing.assert_series_equal(hpat_func(df), test_impl(df), check_names=False) + @skip_numba_jit def test_str_get_parallel(self): def test_impl(df): A = df.A.str.split(',') @@ -492,6 +519,7 @@ def test_impl(df): self.assertEqual(count_array_REPs(), 3) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_str_get_to_numeric(self): def test_impl(df): B = df.A.str.split(',') @@ -503,6 +531,7 @@ def test_impl(df): pd.testing.assert_series_equal( hpat_func(df), test_impl(df), check_names=False) + @skip_numba_jit def test_str_flatten(self): def test_impl(df): A = df.A.str.split(',') @@ -513,6 +542,7 @@ def test_impl(df): pd.testing.assert_series_equal( hpat_func(df), test_impl(df), check_names=False) + @skip_numba_jit def test_str_flatten_parallel(self): def test_impl(df): A = df.A.str.split(',') @@ -529,6 +559,7 @@ def test_impl(df): self.assertEqual(count_array_REPs(), 3) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_to_numeric(self): def test_impl(df): B = pd.to_numeric(df.A, errors='coerce') @@ -539,6 +570,7 @@ def test_impl(df): pd.testing.assert_series_equal( hpat_func(df), test_impl(df), check_names=False) + @skip_numba_jit def test_1D_Var_len(self): def test_impl(n): df = pd.DataFrame({'A': np.arange(n), 'B': np.arange(n) + 1.0}) @@ -551,6 +583,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_rolling1(self): # size 3 without unroll def test_impl(n): @@ -576,6 +609,7 @@ def test_impl_2(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_rolling2(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n), 'B': np.random.ranf(n)}) @@ -588,6 +622,7 @@ def test_impl(n): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_rolling3(self): def test_impl(n): df = pd.DataFrame({'A': np.ones(n), 'B': np.random.ranf(n)}) @@ -637,6 +672,7 @@ def test_impl(df): hpat_func = sdc.jit(test_impl) np.testing.assert_almost_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_df_input2(self): def test_impl(df): C = df.B == 'two' @@ -647,6 +683,7 @@ def test_impl(df): hpat_func = sdc.jit(test_impl) np.testing.assert_almost_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_df_input_dist1(self): def test_impl(df): return df.B.sum() @@ -663,6 +700,7 @@ def test_impl(df): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_concat(self): def test_impl(n): df1 = pd.DataFrame({'key1': np.arange(n), 'A': np.arange(n) + 1.0}) @@ -678,6 +716,7 @@ def test_impl(n): n = 11111 self.assertEqual(hpat_func(n), test_impl(n)) + @skip_numba_jit def test_concat_str(self): def test_impl(): df1 = pq.read_table('example.parquet').to_pandas() @@ -690,6 +729,7 @@ def test_impl(): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_concat_series(self): def test_impl(n): df1 = pd.DataFrame({'key1': np.arange(n), 'A': np.arange(n) + 1.0}) @@ -705,6 +745,7 @@ def test_impl(n): n = 11111 self.assertEqual(hpat_func(n), test_impl(n)) + @skip_numba_jit def test_concat_series_str(self): def test_impl(): df1 = pq.read_table('example.parquet').to_pandas() @@ -717,6 +758,7 @@ def test_impl(): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit @unittest.skipIf(int(os.getenv('SDC_NP_MPI', '0')) > 1, 'Test hangs on NP=2 and NP=3 on all platforms') def test_intraday(self): def test_impl(nsyms): @@ -743,6 +785,7 @@ def test_impl(nsyms): self.assertEqual(count_array_OneDs(), 0) self.assertEqual(count_parfor_OneDs(), 1) + @skip_numba_jit def test_var_dist1(self): def test_impl(A, B): df = pd.DataFrame({'A': A, 'B': B}) diff --git a/sdc/tests/test_hpat_jit.py b/sdc/tests/test_hpat_jit.py index 63de6c7c7..07a7549f0 100644 --- a/sdc/tests/test_hpat_jit.py +++ b/sdc/tests/test_hpat_jit.py @@ -34,9 +34,10 @@ from sdc import * from numba.typed import Dict from collections import defaultdict +from sdc.tests.test_utils import skip_numba_jit, TestCase -class TestHpatJitIssues(unittest.TestCase): +class TestHpatJitIssues(TestCase): @unittest.skip("Dict is not supported as class member") def test_class_with_dict(self): @@ -342,6 +343,7 @@ def test_impl(A, B): pd.testing.assert_series_equal(hpat_func(A, B), test_impl(A, B)) self.assertEqual(count_parfor_REPs(), 3) + @skip_numba_jit @unittest.skipIf(platform.system() == 'Windows', 'AssertionError: Attributes are different' 'Attribute "dtype" are different' @@ -356,6 +358,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) pd.testing.assert_frame_equal(hpat_func(), test_impl()) + @skip_numba_jit @unittest.skipIf(platform.system() == 'Windows', 'AssertionError: Attributes are different' 'Attribute "dtype" are different' @@ -371,6 +374,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) pd.testing.assert_frame_equal(hpat_func(), test_impl()) + @skip_numba_jit @unittest.skipIf(platform.system() == 'Windows', 'AssertionError: Attributes are different' 'Attribute "dtype" are different' @@ -386,6 +390,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) pd.testing.assert_frame_equal(hpat_func(), test_impl()) + @skip_numba_jit @unittest.skipIf(platform.system() == 'Windows', 'AssertionError: Attributes are different' 'Attribute "dtype" are different' @@ -401,6 +406,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) pd.testing.assert_frame_equal(hpat_func(), test_impl()) + @skip_numba_jit @unittest.skipIf(platform.system() == 'Windows', 'AssertionError: Attributes are different' 'Attribute "dtype" are different' @@ -415,6 +421,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) pd.testing.assert_frame_equal(hpat_func(), test_impl()) + @skip_numba_jit @unittest.skipIf(platform.system() == 'Windows', 'AssertionError: Attributes are different' 'Attribute "dtype" are different' diff --git a/sdc/tests/test_io.py b/sdc/tests/test_io.py index 5314eabdd..1dcf9955e 100644 --- a/sdc/tests/test_io.py +++ b/sdc/tests/test_io.py @@ -35,7 +35,8 @@ import sdc from sdc.tests.test_utils import (count_array_REPs, count_parfor_REPs, count_parfor_OneDs, count_array_OneDs, dist_IR_contains, get_rank, - get_start_end) + get_start_end, + skip_numba_jit, TestCase) from numba.config import IS_32BITS from sdc.io.csv_ext import pandas_read_csv as pd_read_csv @@ -44,7 +45,7 @@ kde_file = 'kde.parquet' -class TestIO(unittest.TestCase): +class TestIO(TestCase): def setUp(self): if get_rank() == 0: @@ -85,6 +86,7 @@ def test_impl(): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_pq_read_global_str1(self): def test_impl(): df = pd.read_parquet(kde_file) @@ -161,6 +163,7 @@ def test_impl(): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_pq_str_with_nan_par_multigroup(self): def test_impl(): df = pq.read_table('example2.parquet').to_pandas() @@ -208,6 +211,7 @@ def test_impl(): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_pq_pandas_date(self): def test_impl(): df = pd.read_parquet('pandas_dt.pq') @@ -298,6 +302,7 @@ def test_impl(): ) return test_impl + @skip_numba_jit def test_csv1(self): test_impl = self.pd_csv1() hpat_func = sdc.jit(test_impl) @@ -337,6 +342,7 @@ def test_impl(): ) return test_impl + @skip_numba_jit def test_csv_keys1(self): test_impl = self.pd_csv_keys1() hpat_func = sdc.jit(test_impl) @@ -376,6 +382,7 @@ def test_impl(): ) return test_impl + @skip_numba_jit def test_csv_const_dtype1(self): test_impl = self.pd_csv_const_dtype1() hpat_func = sdc.jit(test_impl) @@ -391,6 +398,7 @@ def test_impl(): return pd_read_csv("csv_data_infer1.csv") return test_impl + @skip_numba_jit def test_csv_infer1(self): test_impl = self.pd_csv_infer1() hpat_func = sdc.jit(test_impl) @@ -408,6 +416,7 @@ def test_impl(): return df.A.sum(), df.B.sum(), df.C.sum(), df.D.sum() return test_impl + @skip_numba_jit def test_csv_infer_parallel1(self): test_impl = self.pd_csv_infer_parallel1() hpat_func = sdc.jit(test_impl) @@ -447,6 +456,7 @@ def test_impl(): ) return test_impl + @skip_numba_jit def test_csv_skip1(self): test_impl = self.pd_csv_skip1() hpat_func = sdc.jit(test_impl) @@ -462,6 +472,7 @@ def test_impl(): return pd_read_csv("csv_data_infer1.csv", skiprows=2) return test_impl + @skip_numba_jit def test_csv_infer_skip1(self): test_impl = self.pd_csv_infer_skip1() hpat_func = sdc.jit(test_impl) @@ -481,6 +492,7 @@ def test_impl(): return df.A.sum(), df.B.sum(), df.C.sum(), df.D.sum() return test_impl + @skip_numba_jit def test_csv_infer_skip_parallel1(self): test_impl = self.pd_csv_infer_skip_parallel1() hpat_func = sdc.jit(test_impl) @@ -502,6 +514,7 @@ def test_impl(): return df.B.values return test_impl + @skip_numba_jit def test_csv_rm_dead1(self): test_impl = self.pd_csv_rm_dead1() hpat_func = sdc.jit(test_impl) @@ -537,6 +550,7 @@ def test_impl(): parse_dates=[2]) return test_impl + @skip_numba_jit def test_csv_date1(self): test_impl = self.pd_csv_date1() hpat_func = sdc.jit(test_impl) @@ -568,6 +582,7 @@ def test_impl(): dtype={'A': np.int, 'B': np.float, 'C': str, 'D': np.int}) return test_impl + @skip_numba_jit def test_csv_str1(self): test_impl = self.pd_csv_str1() hpat_func = sdc.jit(test_impl) @@ -589,6 +604,7 @@ def test_impl(): return (df.A.sum(), df.B.sum(), df.C.sum(), df.D.sum()) return test_impl + @skip_numba_jit def test_csv_parallel1(self): test_impl = self.pd_csv_parallel1() hpat_func = sdc.jit(test_impl) @@ -612,6 +628,7 @@ def test_impl(): df.D.sum()) return test_impl + @skip_numba_jit def test_csv_str_parallel1(self): test_impl = self.pd_csv_str_parallel1() hpat_func = sdc.jit(locals={'df:return': 'distributed'})(test_impl) @@ -635,6 +652,7 @@ def test_impl(): ) return test_impl + @skip_numba_jit def test_csv_usecols1(self): test_impl = self.pd_csv_usecols1() hpat_func = sdc.jit(test_impl) @@ -666,6 +684,7 @@ def test_impl(): return df.C2 return test_impl + @skip_numba_jit def test_csv_cat1(self): test_impl = self.pd_csv_cat1() hpat_func = sdc.jit(test_impl) @@ -710,6 +729,7 @@ def test_impl(): return df return test_impl + @skip_numba_jit def test_csv_cat2(self): test_impl = self.pd_csv_cat2() hpat_func = sdc.jit(test_impl) @@ -733,6 +753,7 @@ def test_impl(): return df return test_impl + @skip_numba_jit def test_csv_single_dtype1(self): test_impl = self.pd_csv_single_dtype1() hpat_func = sdc.jit(test_impl) @@ -774,6 +795,7 @@ def test_impl(n, fname): pd.testing.assert_frame_equal( pd.read_csv(hp_fname), pd.read_csv(pd_fname)) + @skip_numba_jit def test_np_io1(self): def test_impl(): A = np.fromfile("np_file1.dat", np.float64) @@ -782,6 +804,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) np.testing.assert_almost_equal(hpat_func(), test_impl()) + @skip_numba_jit def test_np_io2(self): # parallel version def test_impl(): diff --git a/sdc/tests/test_join.py b/sdc/tests/test_join.py index 34ae874c0..eab75106d 100644 --- a/sdc/tests/test_join.py +++ b/sdc/tests/test_join.py @@ -38,11 +38,13 @@ from sdc.str_arr_ext import StringArray from sdc.tests.test_utils import (count_array_REPs, count_parfor_REPs, count_parfor_OneDs, count_array_OneDs, dist_IR_contains, - get_start_end) + get_start_end, + skip_numba_jit, TestCase) -class TestJoin(unittest.TestCase): +class TestJoin(TestCase): + @skip_numba_jit def test_join1(self): def test_impl(n): df1 = pd.DataFrame({'key1': np.arange(n) + 3, 'A': np.arange(n) + 1.0}) @@ -58,6 +60,7 @@ def test_impl(n): n = 11111 self.assertEqual(hpat_func(n), test_impl(n)) + @skip_numba_jit def test_join1_seq(self): def test_impl(df1, df2): df3 = df1.merge(df2, left_on='key1', right_on='key2') @@ -73,6 +76,7 @@ def test_impl(df1, df2): df2 = pd.DataFrame({'key2': 2 * np.arange(n) + 1, 'B': n + np.arange(n) + 1.0}) pd.testing.assert_frame_equal(hpat_func(df1, df2), test_impl(df1, df2)) + @skip_numba_jit def test_join1_seq_str(self): def test_impl(): df1 = pd.DataFrame({'key1': ['foo', 'bar', 'baz']}) @@ -83,6 +87,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) self.assertEqual(set(hpat_func()), set(test_impl())) + @skip_numba_jit def test_join1_seq_str_na(self): # test setting NA in string data column def test_impl(): @@ -94,6 +99,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) self.assertEqual(set(hpat_func()), set(test_impl())) + @skip_numba_jit def test_join_mutil_seq1(self): def test_impl(df1, df2): return df1.merge(df2, on=['A', 'B']) @@ -109,6 +115,7 @@ def test_impl(df1, df2): pd.testing.assert_frame_equal(hpat_func(df1, df2), test_impl(df1, df2)) + @skip_numba_jit def test_join_mutil_parallel1(self): def test_impl(A1, B1, C1, A2, B2, D2): df1 = pd.DataFrame({'A': A1, 'B': B1, 'C': C1}) @@ -148,6 +155,7 @@ def test_impl(A1, B1, C1, A2, B2, D2): p_res = test_impl(p_A1, p_B1, p_C1, p_A2, p_B2, p_D2) self.assertEqual(h_res, p_res) + @skip_numba_jit def test_join_left_parallel1(self): """ """ @@ -187,6 +195,7 @@ def test_impl(A1, B1, C1, A2, B2, D2): self.assertEqual(h_res, p_res) self.assertEqual(count_array_OneDs(), 3) + @skip_numba_jit def test_join_datetime_seq1(self): def test_impl(df1, df2): return pd.merge(df1, df2, on='time') @@ -221,6 +230,7 @@ def test_impl(df1, df2): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_merge_asof_seq1(self): def test_impl(df1, df2): return pd.merge_asof(df1, df2, on='time') @@ -246,6 +256,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) self.assertEqual(hpat_func(), test_impl()) + @skip_numba_jit def test_join_left_seq1(self): def test_impl(df1, df2): return pd.merge(df1, df2, how='left', on='key') @@ -263,6 +274,7 @@ def test_impl(df1, df2): self.assertEqual( set(h_res.B.dropna().values), set(res.B.dropna().values)) + @skip_numba_jit def test_join_left_seq2(self): def test_impl(df1, df2): return pd.merge(df1, df2, how='left', on='key') @@ -281,6 +293,7 @@ def test_impl(df1, df2): self.assertEqual( set(h_res.B.dropna().values), set(res.B.dropna().values)) + @skip_numba_jit def test_join_right_seq1(self): def test_impl(df1, df2): return pd.merge(df1, df2, how='right', on='key') @@ -298,6 +311,7 @@ def test_impl(df1, df2): self.assertEqual( set(h_res.A.dropna().values), set(res.A.dropna().values)) + @skip_numba_jit def test_join_outer_seq1(self): def test_impl(df1, df2): return pd.merge(df1, df2, how='outer', on='key') @@ -316,6 +330,7 @@ def test_impl(df1, df2): self.assertEqual( set(h_res.A.dropna().values), set(res.A.dropna().values)) + @skip_numba_jit def test_join1_seq_key_change1(self): # make sure const list typing doesn't replace const key values def test_impl(df1, df2, df3, df4): @@ -331,6 +346,7 @@ def test_impl(df1, df2, df3, df4): df4 = pd.DataFrame({'B': 2 * np.arange(n) + 1, 'BBB': n + np.arange(n) + 1.0}) pd.testing.assert_frame_equal(hpat_func(df1, df2, df3, df4)[1], test_impl(df1, df2, df3, df4)[1]) + @skip_numba_jit @unittest.skipIf(platform.system() == 'Windows', "error on windows") def test_join_cat1(self): def test_impl(): @@ -348,6 +364,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) pd.testing.assert_frame_equal(hpat_func(), test_impl()) + @skip_numba_jit @unittest.skipIf(platform.system() == 'Windows', "error on windows") def test_join_cat2(self): # test setting NaN in categorical array @@ -368,6 +385,7 @@ def test_impl(): hpat_func().sort_values('C1').reset_index(drop=True), test_impl().sort_values('C1').reset_index(drop=True)) + @skip_numba_jit @unittest.skipIf(platform.system() == 'Windows', "error on windows") def test_join_cat_parallel1(self): # TODO: cat as keys diff --git a/sdc/tests/test_ml.py b/sdc/tests/test_ml.py index 40d27d85d..0f3beaaaf 100644 --- a/sdc/tests/test_ml.py +++ b/sdc/tests/test_ml.py @@ -34,11 +34,13 @@ from sdc.tests.test_utils import (count_array_REPs, count_parfor_REPs, count_parfor_OneDs, count_array_OneDs, count_parfor_OneD_Vars, count_array_OneD_Vars, - dist_IR_contains, check_numba_version) + dist_IR_contains, check_numba_version, + skip_numba_jit, TestCase) -class TestML(unittest.TestCase): +class TestML(TestCase): + @skip_numba_jit def test_logistic_regression(self): def test_impl(n, d): iterations = 3 @@ -57,6 +59,7 @@ def test_impl(n, d): self.assertEqual(count_array_OneDs(), 3) self.assertEqual(count_parfor_OneDs(), 3) + @skip_numba_jit def test_logistic_regression_acc(self): def test_impl(N, D): iterations = 3 @@ -78,6 +81,7 @@ def test_impl(N, D): self.assertEqual(count_array_OneDs(), 3) self.assertEqual(count_parfor_OneDs(), 4) + @skip_numba_jit def test_linear_regression(self): def test_impl(N, D): p = 2 @@ -97,6 +101,7 @@ def test_impl(N, D): self.assertEqual(count_array_OneDs(), 5) self.assertEqual(count_parfor_OneDs(), 3) + @skip_numba_jit def test_kde(self): def test_impl(n): X = np.ones(n) diff --git a/sdc/tests/test_rolling.py b/sdc/tests/test_rolling.py index 2153621bc..27d91b0d2 100644 --- a/sdc/tests/test_rolling.py +++ b/sdc/tests/test_rolling.py @@ -34,7 +34,8 @@ import numba import sdc from sdc.tests.test_utils import (count_array_REPs, count_parfor_REPs, - count_parfor_OneDs, count_array_OneDs, dist_IR_contains) + count_parfor_OneDs, count_array_OneDs, dist_IR_contains, + skip_numba_jit, TestCase) from sdc.hiframes.rolling import supported_rolling_funcs LONG_TEST = (int(os.environ['SDC_LONG_ROLLING_TEST']) != 0 @@ -46,7 +47,7 @@ test_funcs = supported_rolling_funcs[:-3] -class TestRolling(unittest.TestCase): +class TestRolling(TestCase): def test_fixed1(self): # test sequentially with manually created dfs wins = (3,) @@ -85,6 +86,7 @@ def test_fixed2(self): df = pd.DataFrame({'B': np.arange(n)}) pd.testing.assert_frame_equal(hpat_func(df, w, c), test_impl(df, w, c)) + @skip_numba_jit def test_fixed_apply1(self): # test sequentially with manually created dfs def test_impl(df, w, c): @@ -100,6 +102,7 @@ def test_impl(df, w, c): df = pd.DataFrame({'B': [0, 1, 2, -2, 4]}) pd.testing.assert_frame_equal(hpat_func(df, *args), test_impl(df, *args)) + @skip_numba_jit def test_fixed_apply2(self): # test sequentially with generated dfs def test_impl(df, w, c): @@ -134,6 +137,7 @@ def test_impl(n, w, center): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_fixed_parallel_apply1(self): def test_impl(n, w, center): df = pd.DataFrame({'B': np.arange(n)}) @@ -202,6 +206,7 @@ def test_variable2(self): df = pd.DataFrame({'B': np.arange(n), 'time': time}) pd.testing.assert_frame_equal(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_variable_apply1(self): # test sequentially with manually created dfs df1 = pd.DataFrame({'B': [0, 1, 2, np.nan, 4], @@ -229,6 +234,7 @@ def test_variable_apply1(self): pd.testing.assert_frame_equal(hpat_func(df1), test_impl(df1)) pd.testing.assert_frame_equal(hpat_func(df2), test_impl(df2)) + @skip_numba_jit def test_variable_apply2(self): # test sequentially with generated dfs wins = ('2s',) @@ -273,6 +279,7 @@ def test_variable_parallel1(self): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit @unittest.skipIf(platform.system() == 'Windows', "ValueError: time must be monotonic") def test_variable_apply_parallel1(self): wins = ('2s',) @@ -297,6 +304,7 @@ def test_variable_apply_parallel1(self): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_series_fixed1(self): # test series rolling functions # all functions except apply @@ -324,6 +332,7 @@ def apply_test_impl(S, w, c): pd.testing.assert_series_equal(hpat_func(S1, *args), apply_test_impl(S1, *args)) pd.testing.assert_series_equal(hpat_func(S2, *args), apply_test_impl(S2, *args)) + @skip_numba_jit def test_series_cov1(self): # test series rolling functions # all functions except apply @@ -348,6 +357,7 @@ def test_impl2(S, S2, w, c): pd.testing.assert_series_equal(hpat_func(*args), test_impl2(*args)) pd.testing.assert_series_equal(hpat_func(*args), test_impl2(*args)) + @skip_numba_jit def test_df_cov1(self): # test series rolling functions # all functions except apply diff --git a/sdc/tests/test_series.py b/sdc/tests/test_series.py index cb075121e..17b6f6d66 100644 --- a/sdc/tests/test_series.py +++ b/sdc/tests/test_series.py @@ -35,7 +35,8 @@ import sdc from itertools import islice, permutations from sdc.tests.test_utils import ( - count_array_REPs, count_parfor_REPs, count_array_OneDs, get_start_end) + count_array_REPs, count_parfor_REPs, count_array_OneDs, get_start_end, + skip_numba_jit, skip_sdc_jit, TestCase) from sdc.tests.gen_test_data import ParquetGenerator from numba import types from numba.config import IS_32BITS @@ -209,11 +210,9 @@ def _make_func_use_method_arg1(method): GLOBAL_VAL = 2 -class TestSeries(unittest.TestCase): - - def jit(self, *args, **kwargs): - return sdc.jit(*args, **kwargs) +class TestSeries(TestCase): + @skip_numba_jit def test_create1(self): def test_impl(): df = pd.DataFrame({'A': [1, 2, 3]}) @@ -264,6 +263,7 @@ def test_impl(): result = hpat_func() pd.testing.assert_series_equal(result, result_ref) + @skip_numba_jit def test_create2(self): def test_impl(n): df = pd.DataFrame({'A': np.arange(n)}) @@ -314,6 +314,7 @@ def test_impl(name): pd.testing.assert_series_equal(hpat_func('A'), test_impl('A')) + @skip_numba_jit def test_create_str(self): def test_impl(): df = pd.DataFrame({'A': ['a', 'b', 'c']}) @@ -322,6 +323,7 @@ def test_impl(): self.assertEqual(hpat_func(), test_impl()) + @skip_numba_jit def test_pass_df1(self): def test_impl(df): return (df.A == 2).sum() @@ -331,6 +333,7 @@ def test_impl(df): df = pd.DataFrame({'A': np.arange(n)}) self.assertEqual(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_pass_df_str(self): def test_impl(df): return (df.A == 'a').sum() @@ -339,6 +342,7 @@ def test_impl(df): df = pd.DataFrame({'A': ['a', 'b', 'c']}) self.assertEqual(hpat_func(df), test_impl(df)) + @skip_numba_jit def test_pass_series1(self): # TODO: check to make sure it is series type def test_impl(A): @@ -349,6 +353,7 @@ def test_impl(A): df = pd.DataFrame({'A': np.arange(n)}) self.assertEqual(hpat_func(df.A), test_impl(df.A)) + @skip_numba_jit def test_pass_series2(self): # test creating dataframe from passed series def test_impl(A): @@ -360,6 +365,7 @@ def test_impl(A): df = pd.DataFrame({'A': np.arange(n)}) self.assertEqual(hpat_func(df.A), test_impl(df.A)) + @skip_numba_jit def test_pass_series_str(self): def test_impl(A): return (A == 'a').sum() @@ -393,6 +399,7 @@ def test_impl(S): self.assertEqual(hpat_func(S), expected) self.assertEqual(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_attr2(self): def test_impl(A): return A.copy().values @@ -411,6 +418,7 @@ def test_impl(A): df = pd.DataFrame({'A': np.arange(n)}) self.assertEqual(hpat_func(df.A), test_impl(df.A)) + @skip_numba_jit("This test passes in group and fails in single.") def test_series_attr4(self): def test_impl(A): return A.cumsum().values @@ -420,6 +428,7 @@ def test_impl(A): df = pd.DataFrame({'A': np.arange(n)}) np.testing.assert_array_equal(hpat_func(df.A), test_impl(df.A)) + @skip_numba_jit def test_series_argsort1(self): def test_impl(A): return A.argsort() @@ -429,6 +438,7 @@ def test_impl(A): A = pd.Series(np.random.ranf(n)) pd.testing.assert_series_equal(hpat_func(A), test_impl(A)) + @skip_numba_jit def test_series_argsort2(self): def test_impl(S): return S.argsort() @@ -437,6 +447,7 @@ def test_impl(S): S = pd.Series([1, -1, 0, 1, np.nan], [1, 2, 3, 4, 5]) pd.testing.assert_series_equal(test_impl(S), hpat_func(S)) + @skip_numba_jit def test_series_argsort_full(self): def test_impl(series, kind): return series.argsort(axis=0, kind=kind, order=None) @@ -457,6 +468,7 @@ def test_impl(series, kind): else: np.testing.assert_array_equal(ref, jit) + @skip_numba_jit def test_series_argsort_full_idx(self): def test_impl(series, kind): return series.argsort(axis=0, kind=kind, order=None) @@ -479,6 +491,7 @@ def test_impl(series, kind): else: np.testing.assert_array_equal(ref, jit) + @skip_numba_jit def test_series_attr6(self): def test_impl(A): return A.take([2, 3]).values @@ -488,6 +501,7 @@ def test_impl(A): df = pd.DataFrame({'A': np.arange(n)}) np.testing.assert_array_equal(hpat_func(df.A), test_impl(df.A)) + @skip_numba_jit def test_series_attr7(self): def test_impl(A): return A.astype(np.float64) @@ -558,8 +572,7 @@ def test_impl(A, deep): self.assertEqual(actual.index is S.index, expected.index is S.index) self.assertEqual(actual.index is S.index, not deep) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.corr() parameter "min_periods" unsupported') + @skip_sdc_jit('Series.corr() parameter "min_periods" unsupported') def test_series_corr(self): def test_series_corr_impl(S1, S2, min_periods=None): return S1.corr(S2, min_periods=min_periods) @@ -586,8 +599,7 @@ def test_series_corr_impl(S1, S2, min_periods=None): result = hpat_func(S1, S2, min_periods=period) np.testing.assert_allclose(result, result_ref) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.corr() parameter "min_periods" unsupported') + @skip_sdc_jit('Series.corr() parameter "min_periods" unsupported') def test_series_corr_unsupported_dtype(self): def test_series_corr_impl(S1, S2, min_periods=None): return S1.corr(S2, min_periods=min_periods) @@ -608,8 +620,7 @@ def test_series_corr_impl(S1, S2, min_periods=None): msg = 'Method corr(). The object self.data' self.assertIn(msg, str(raises.exception)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.corr() parameter "min_periods" unsupported') + @skip_sdc_jit('Series.corr() parameter "min_periods" unsupported') def test_series_corr_unsupported_period(self): def test_series_corr_impl(S1, S2, min_periods=None): return S1.corr(S2, min_periods) @@ -628,6 +639,7 @@ def test_series_corr_impl(S1, S2, min_periods=None): msg = 'Method corr(). The object min_periods' self.assertIn(msg, str(raises.exception)) + @skip_numba_jit def test_series_astype_int_to_str1(self): '''Verifies Series.astype implementation with function 'str' as argument converts integer series to series of strings @@ -640,6 +652,7 @@ def test_impl(S): S = pd.Series(np.arange(n)) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_astype_int_to_str2(self): '''Verifies Series.astype implementation with a string literal dtype argument converts integer series to series of strings @@ -652,6 +665,7 @@ def test_impl(S): S = pd.Series(np.arange(n)) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_astype_str_to_str1(self): '''Verifies Series.astype implementation with function 'str' as argument handles string series not changing it @@ -663,6 +677,7 @@ def test_impl(S): S = pd.Series(['aa', 'bb', 'cc']) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_astype_str_to_str2(self): '''Verifies Series.astype implementation with a string literal dtype argument handles string series not changing it @@ -674,6 +689,7 @@ def test_impl(S): S = pd.Series(['aa', 'bb', 'cc']) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_astype_str_to_str_index_str(self): '''Verifies Series.astype implementation with function 'str' as argument handles string series not changing it @@ -687,6 +703,7 @@ def test_impl(S): S = pd.Series(['aa', 'bb', 'cc'], index=['d', 'e', 'f']) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_astype_str_to_str_index_int(self): '''Verifies Series.astype implementation with function 'str' as argument handles string series not changing it @@ -731,6 +748,7 @@ def test_impl(A): S = pd.Series(np.arange(n)) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_astype_int32_to_int64(self): '''Verifies Series.astype implementation with NumPy dtype argument converts series with dtype=int32 to series with dtype=int64 @@ -743,6 +761,7 @@ def test_impl(A): S = pd.Series(np.arange(n), dtype=np.int32) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_astype_int_to_float64(self): '''Verifies Series.astype implementation with NumPy dtype argument converts integer series to series of float @@ -755,6 +774,7 @@ def test_impl(A): S = pd.Series(np.arange(n)) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_astype_float_to_int32(self): '''Verifies Series.astype implementation with NumPy dtype argument converts float series to series of integers @@ -806,6 +826,7 @@ def test_impl(A): S = pd.Series(['3.24', '1E+05', '-1', '-1.3E-01', 'nan', 'inf']) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_astype_str_index_str(self): '''Verifies Series.astype implementation with function 'str' as argument handles string series not changing it @@ -818,6 +839,7 @@ def test_impl(S): S = pd.Series(['aa', 'bb', 'cc'], index=['a', 'b', 'c']) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_astype_str_index_int(self): '''Verifies Series.astype implementation with function 'str' as argument handles string series not changing it @@ -844,6 +866,7 @@ def test_impl(S): S = pd.Series(['aa', 'bb', 'cc'], index=[2, 3, 5]) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_np_call_on_series1(self): def test_impl(A): return np.min(A) @@ -862,6 +885,7 @@ def test_impl(A): df = pd.DataFrame({'A': np.arange(n)}) np.testing.assert_array_equal(hpat_func(df.A), test_impl(df.A)) + @skip_numba_jit def test_series_values1(self): def test_impl(A): return (A == 2).values @@ -880,6 +904,7 @@ def test_impl(A): df = pd.DataFrame({'A': np.arange(n)}) self.assertEqual(hpat_func(df.A), test_impl(df.A)) + @skip_numba_jit def test_static_setitem_series1(self): def test_impl(A): A[0] = 2 @@ -890,6 +915,7 @@ def test_impl(A): df = pd.DataFrame({'A': np.arange(n)}) self.assertEqual(hpat_func(df.A), test_impl(df.A)) + @skip_numba_jit def test_setitem_series1(self): def test_impl(A, i): A[i] = 2 @@ -900,6 +926,7 @@ def test_impl(A, i): df = pd.DataFrame({'A': np.arange(n)}) self.assertEqual(hpat_func(df.A.copy(), 0), test_impl(df.A.copy(), 0)) + @skip_numba_jit def test_setitem_series2(self): def test_impl(A, i): A[i] = 100 @@ -928,6 +955,7 @@ def test_impl(A, i): test_impl(A2, 0) np.testing.assert_array_equal(A1, A2) + @skip_numba_jit def test_setitem_series_bool1(self): def test_impl(A): A[A > 3] = 100 @@ -941,6 +969,7 @@ def test_impl(A): test_impl(A2) pd.testing.assert_series_equal(A1, A2) + @skip_numba_jit def test_setitem_series_bool2(self): def test_impl(A, B): A[A > 3] = B[A > 3] @@ -954,6 +983,7 @@ def test_impl(A, B): test_impl(A2, df.B) pd.testing.assert_series_equal(A1, A2) + @skip_numba_jit def test_static_getitem_series1(self): def test_impl(A): return A[0] @@ -963,6 +993,7 @@ def test_impl(A): A = pd.Series(np.arange(n)) self.assertEqual(hpat_func(A), test_impl(A)) + @skip_numba_jit def test_getitem_series1(self): def test_impl(A, i): return A[i] @@ -972,6 +1003,7 @@ def test_impl(A, i): df = pd.DataFrame({'A': np.arange(n)}) self.assertEqual(hpat_func(df.A, 0), test_impl(df.A, 0)) + @skip_numba_jit def test_getitem_series_str1(self): def test_impl(A, i): return A[i] @@ -980,6 +1012,7 @@ def test_impl(A, i): df = pd.DataFrame({'A': ['aa', 'bb', 'cc']}) self.assertEqual(hpat_func(df.A, 0), test_impl(df.A, 0)) + @skip_numba_jit def test_series_iat1(self): def test_impl(A): return A.iat[3] @@ -989,6 +1022,7 @@ def test_impl(A): S = pd.Series(np.arange(n)**2) self.assertEqual(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_iat2(self): def test_impl(A): A.iat[3] = 1 @@ -999,6 +1033,7 @@ def test_impl(A): S = pd.Series(np.arange(n)**2) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_iloc1(self): def test_impl(A): return A.iloc[3] @@ -1008,6 +1043,7 @@ def test_impl(A): S = pd.Series(np.arange(n)**2) self.assertEqual(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_iloc2(self): def test_impl(A): return A.iloc[3:8] @@ -1018,6 +1054,7 @@ def test_impl(A): pd.testing.assert_series_equal( hpat_func(S), test_impl(S).reset_index(drop=True)) + @skip_numba_jit def test_series_op1(self): arithmetic_binops = ('+', '-', '*', '/', '//', '%', '**') for operator in arithmetic_binops: @@ -1028,6 +1065,7 @@ def test_series_op1(self): df = pd.DataFrame({'A': np.arange(1, n), 'B': np.ones(n - 1)}) pd.testing.assert_series_equal(hpat_func(df.A, df.B), test_impl(df.A, df.B), check_names=False) + @skip_numba_jit def test_series_op2(self): arithmetic_binops = ('+', '-', '*', '/', '//', '%', '**') @@ -1042,6 +1080,7 @@ def test_series_op2(self): df = pd.DataFrame({'A': np.arange(1, n)}) pd.testing.assert_series_equal(hpat_func(df.A, 1), test_impl(df.A, 1), check_names=False) + @skip_numba_jit def test_series_op3(self): arithmetic_binops = ('+', '-', '*', '/', '//', '%', '**') @@ -1053,6 +1092,7 @@ def test_series_op3(self): df = pd.DataFrame({'A': np.arange(1, n), 'B': np.ones(n - 1)}) pd.testing.assert_series_equal(hpat_func(df.A, df.B), test_impl(df.A, df.B), check_names=False) + @skip_numba_jit def test_series_op4(self): arithmetic_binops = ('+', '-', '*', '/', '//', '%', '**') @@ -1111,6 +1151,7 @@ def test_series_op5_float_scalar(self): test_impl(operand_series, operand_scalar), check_names=False) + @skip_numba_jit def test_series_op6(self): def test_impl(A): return -A @@ -1120,6 +1161,7 @@ def test_impl(A): A = pd.Series(np.arange(n)) pd.testing.assert_series_equal(hpat_func(A), test_impl(A)) + @skip_numba_jit def test_series_op7(self): comparison_binops = ('<', '>', '<=', '>=', '!=', '==') @@ -1175,6 +1217,7 @@ def test_series_op8_float_scalar(self): test_impl(operand_series, operand_scalar), check_names=False) + @skip_numba_jit def test_series_inplace_binop_array(self): def test_impl(A, B): A += B @@ -1186,6 +1229,7 @@ def test_impl(A, B): B = pd.Series(np.ones(n)) np.testing.assert_array_equal(hpat_func(A.copy(), B), test_impl(A, B)) + @skip_numba_jit def test_series_fusion1(self): def test_impl(A, B): return A + B + 1 @@ -1201,6 +1245,7 @@ def test_impl(A, B): pd.testing.assert_series_equal(hpat_func(A, B), test_impl(A, B)) self.assertEqual(count_parfor_REPs(), 1) + @skip_numba_jit def test_series_fusion2(self): # make sure getting data var avoids incorrect single def assumption def test_impl(A, B): @@ -1245,6 +1290,7 @@ def test_impl(): pd.testing.assert_series_equal(hpat_func(), test_impl()) + @skip_numba_jit def test_series_list_str_unbox1(self): def test_impl(A): return A.iloc[0] @@ -1265,6 +1311,7 @@ def test_impl(i): self.assertEqual(hpat_func(1), test_impl(1)) + @skip_numba_jit def test_series_ufunc1(self): def test_impl(A, i): return np.isinf(A).values @@ -1274,6 +1321,7 @@ def test_impl(A, i): df = pd.DataFrame({'A': np.arange(n)}) np.testing.assert_array_equal(hpat_func(df.A, 1), test_impl(df.A, 1)) + @skip_numba_jit def test_list_convert(self): def test_impl(): df = pd.DataFrame({'one': np.array([-1, np.nan, 2.5]), @@ -1296,8 +1344,7 @@ def test_impl(A): df = pd.DataFrame({'A': np.arange(n)}) self.assertTrue(isinstance(hpat_func(df.A), np.ndarray)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'No support of axis argument in old-style Series.fillna() impl') + @skip_sdc_jit('No support of axis argument in old-style Series.fillna() impl') def test_series_fillna_axis1(self): '''Verifies Series.fillna() implementation handles 'index' as axis argument''' def test_impl(S): @@ -1307,8 +1354,7 @@ def test_impl(S): S = pd.Series([1.0, 2.0, np.nan, 1.0, np.inf]) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'No support of axis argument in old-style Series.fillna() impl') + @skip_sdc_jit('No support of axis argument in old-style Series.fillna() impl') def test_series_fillna_axis2(self): '''Verifies Series.fillna() implementation handles 0 as axis argument''' def test_impl(S): @@ -1318,8 +1364,7 @@ def test_impl(S): S = pd.Series([1.0, 2.0, np.nan, 1.0, np.inf]) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'No support of axis argument in old-style Series.fillna() impl') + @skip_sdc_jit('No support of axis argument in old-style Series.fillna() impl') def test_series_fillna_axis3(self): '''Verifies Series.fillna() implementation handles correct non-literal axis argument''' def test_impl(S, axis): @@ -1330,8 +1375,7 @@ def test_impl(S, axis): for axis in [0, 'index']: pd.testing.assert_series_equal(hpat_func(S, axis), test_impl(S, axis)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style fillna impl returns series without index') + @skip_sdc_jit('BUG: old-style fillna impl returns series without index') def test_series_fillna_float_from_df(self): '''Verifies Series.fillna() applied to a named float Series obtained from a DataFrame''' def test_impl(S): @@ -1342,8 +1386,7 @@ def test_impl(S): df = pd.DataFrame({'A': [1.0, 2.0, np.nan, 1.0, np.inf]}) pd.testing.assert_series_equal(hpat_func(df.A), test_impl(df.A), check_names=False) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style fillna impl returns series without index') + @skip_sdc_jit('BUG: old-style fillna impl returns series without index') def test_series_fillna_float_index1(self): '''Verifies Series.fillna() implementation for float series with default index''' def test_impl(S): @@ -1354,8 +1397,7 @@ def test_impl(S): S = pd.Series(data) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style fillna impl returns series without index') + @skip_sdc_jit('BUG: old-style fillna impl returns series without index') def test_series_fillna_float_index2(self): '''Verifies Series.fillna() implementation for float series with string index''' def test_impl(S): @@ -1365,8 +1407,7 @@ def test_impl(S): S = pd.Series([1.0, 2.0, np.nan, 1.0, np.inf], ['a', 'b', 'c', 'd', 'e']) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style fillna impl returns series without index') + @skip_sdc_jit('BUG: old-style fillna impl returns series without index') def test_series_fillna_float_index3(self): def test_impl(S): return S.fillna(5.0) @@ -1375,8 +1416,7 @@ def test_impl(S): S = pd.Series([1.0, 2.0, np.nan, 1.0, np.inf], index=[1, 2, 5, 7, 10]) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style fillna impl returns series without index') + @skip_sdc_jit('BUG: old-style fillna impl returns series without index') def test_series_fillna_str_from_df(self): '''Verifies Series.fillna() applied to a named float Series obtained from a DataFrame''' def test_impl(S): @@ -1388,8 +1428,7 @@ def test_impl(S): pd.testing.assert_series_equal(hpat_func(df.A), test_impl(df.A), check_names=False) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style fillna impl returns series without index') + @skip_sdc_jit('BUG: old-style fillna impl returns series without index') def test_series_fillna_str_index1(self): '''Verifies Series.fillna() implementation for series of strings with default index''' def test_impl(S): @@ -1399,8 +1438,7 @@ def test_impl(S): S = pd.Series(['aa', 'b', None, 'cccd', '']) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style fillna impl returns series without index') + @skip_sdc_jit('BUG: old-style fillna impl returns series without index') def test_series_fillna_str_index2(self): '''Verifies Series.fillna() implementation for series of strings with string index''' def test_impl(S): @@ -1410,8 +1448,7 @@ def test_impl(S): S = pd.Series(['aa', 'b', None, 'cccd', ''], ['a', 'b', 'c', 'd', 'e']) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style fillna impl returns series without index') + @skip_sdc_jit('BUG: old-style fillna impl returns series without index') def test_series_fillna_str_index3(self): def test_impl(S): return S.fillna("dd") @@ -1421,8 +1458,7 @@ def test_impl(S): S = pd.Series(['aa', 'b', None, 'cccd', ''], index=[1, 2, 5, 7, 10]) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style fillna impl returns series without index') + @skip_sdc_jit('BUG: old-style fillna impl returns series without index') def test_series_fillna_float_inplace1(self): '''Verifies Series.fillna() implementation for float series with default index and inplace argument True''' def test_impl(S): @@ -1447,6 +1483,7 @@ def test_impl(S): self.assertIsNone(test_impl(S2)) pd.testing.assert_series_equal(S1, S2) + @skip_numba_jit def test_series_fillna_float_inplace3(self): '''Verifies Series.fillna() implementation correcly handles omitted inplace argument as default False''' def test_impl(S): @@ -1458,6 +1495,7 @@ def test_impl(S): pd.testing.assert_series_equal(hpat_func(S1), test_impl(S1)) pd.testing.assert_series_equal(S1, S2) + @skip_numba_jit def test_series_fillna_inplace_non_literal(self): '''Verifies Series.fillna() implementation handles only Boolean literals as inplace argument''' def test_impl(S, param): @@ -1469,8 +1507,7 @@ def test_impl(S, param): expected = ValueError if sdc.config.config_pipeline_hpat_default else TypingError self.assertRaises(expected, hpat_func, S, True) - @unittest.skipUnless(sdc.config.config_pipeline_hpat_default, - 'TODO: investigate why Numba types inplace as bool (non-literal value)') + @skip_numba_jit('TODO: investigate why Numba types inplace as bool (non-literal value)') def test_series_fillna_str_inplace1(self): '''Verifies Series.fillna() implementation for series of strings with default index and inplace argument True @@ -1498,8 +1535,7 @@ def test_impl(S): self.assertIsNone(test_impl(S2)) pd.testing.assert_series_equal(S1, S2) - @unittest.skipUnless(sdc.config.config_pipeline_hpat_default, - 'TODO: investigate why Numba types inplace as bool (non-literal value)') + @skip_numba_jit('TODO: investigate why Numba types inplace as bool (non-literal value)') def test_series_fillna_str_inplace_empty1(self): def test_impl(A): A.fillna("", inplace=True) @@ -1535,6 +1571,7 @@ def test_impl(S): S = pd.Series([pd.NaT, pd.Timestamp('1970-12-01'), pd.Timestamp('2012-07-25')]) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_fillna_bool_no_index1(self): '''Verifies Series.fillna() implementation for bool series with default index''' def test_impl(S): @@ -1545,8 +1582,7 @@ def test_impl(S): S2 = S1.copy() pd.testing.assert_series_equal(hpat_func(S1), test_impl(S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style fillna impl returns series without index') + @skip_sdc_jit('BUG: old-style fillna impl returns series without index') def test_series_fillna_int_no_index1(self): '''Verifies Series.fillna() implementation for integer series with default index''' def test_impl(S): @@ -1558,8 +1594,7 @@ def test_impl(S): S2 = S1.copy() pd.testing.assert_series_equal(hpat_func(S1), test_impl(S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'No support of axis argument in old-style Series.dropna() impl') + @skip_sdc_jit('No support of axis argument in old-style Series.dropna() impl') def test_series_dropna_axis1(self): '''Verifies Series.dropna() implementation handles 'index' as axis argument''' def test_impl(S): @@ -1570,8 +1605,7 @@ def test_impl(S): S2 = S1.copy() pd.testing.assert_series_equal(hpat_func(S1), test_impl(S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'No support of axis argument in old-style Series.dropna() impl') + @skip_sdc_jit('No support of axis argument in old-style Series.dropna() impl') def test_series_dropna_axis2(self): '''Verifies Series.dropna() implementation handles 0 as axis argument''' def test_impl(S): @@ -1582,8 +1616,7 @@ def test_impl(S): S2 = S1.copy() pd.testing.assert_series_equal(hpat_func(S1), test_impl(S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'No support of axis argument in old-style Series.dropna() impl') + @skip_sdc_jit('No support of axis argument in old-style Series.dropna() impl') def test_series_dropna_axis3(self): '''Verifies Series.dropna() implementation handles correct non-literal axis argument''' def test_impl(S, axis): @@ -1595,8 +1628,7 @@ def test_impl(S, axis): for axis in [0, 'index']: pd.testing.assert_series_equal(hpat_func(S1, axis), test_impl(S2, axis)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style dropna impl returns series without index') + @skip_sdc_jit('BUG: old-style dropna impl returns series without index') def test_series_dropna_float_index1(self): '''Verifies Series.dropna() implementation for float series with default index''' def test_impl(S): @@ -1608,8 +1640,7 @@ def test_impl(S): S2 = S1.copy() pd.testing.assert_series_equal(hpat_func(S1), test_impl(S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style dropna impl returns series without index') + @skip_sdc_jit('BUG: old-style dropna impl returns series without index') def test_series_dropna_float_index2(self): '''Verifies Series.dropna() implementation for float series with string index''' def test_impl(S): @@ -1620,8 +1651,7 @@ def test_impl(S): S2 = S1.copy() pd.testing.assert_series_equal(hpat_func(S1), test_impl(S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style dropna impl returns series without index') + @skip_sdc_jit('BUG: old-style dropna impl returns series without index') def test_series_dropna_str_index1(self): '''Verifies Series.dropna() implementation for series of strings with default index''' def test_impl(S): @@ -1632,8 +1662,7 @@ def test_impl(S): S2 = S1.copy() pd.testing.assert_series_equal(hpat_func(S1), test_impl(S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style dropna impl returns series without index') + @skip_sdc_jit('BUG: old-style dropna impl returns series without index') def test_series_dropna_str_index2(self): '''Verifies Series.dropna() implementation for series of strings with string index''' def test_impl(S): @@ -1644,8 +1673,7 @@ def test_impl(S): S2 = S1.copy() pd.testing.assert_series_equal(hpat_func(S1), test_impl(S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style dropna impl returns series without index') + @skip_sdc_jit('BUG: old-style dropna impl returns series without index') def test_series_dropna_str_index3(self): def test_impl(S): return S.dropna() @@ -1708,6 +1736,7 @@ def test_impl(S): self.assertIsNone(test_impl(S2)) pd.testing.assert_series_equal(S1, S2) + @skip_numba_jit def test_series_dropna_str_parallel1(self): '''Verifies Series.dropna() distributed work for series of strings with default index''' def test_impl(A): @@ -1737,6 +1766,7 @@ def test_impl(S): S2 = S1.copy() pd.testing.assert_series_equal(hpat_func(S1), test_impl(S2)) + @skip_numba_jit def test_series_dropna_bool_no_index1(self): '''Verifies Series.dropna() implementation for bool series with default index''' def test_impl(S): @@ -1747,8 +1777,7 @@ def test_impl(S): S2 = S1.copy() pd.testing.assert_series_equal(hpat_func(S1), test_impl(S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'BUG: old-style dropna impl returns series without index') + @skip_sdc_jit('BUG: old-style dropna impl returns series without index') def test_series_dropna_int_no_index1(self): '''Verifies Series.dropna() implementation for integer series with default index''' def test_impl(S): @@ -1794,7 +1823,7 @@ def test_impl(S): S = pd.Series([np.nan, np.nan]) self.assertEqual(hpat_func(S), test_impl(S)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, "Old style Series.sum() does not support parameters") + @skip_sdc_jit("Old style Series.sum() does not support parameters") def test_series_sum_skipna_false(self): def test_impl(S): return S.sum(skipna=False) @@ -1803,8 +1832,7 @@ def test_impl(S): S = pd.Series([np.nan, 2., 3.]) self.assertEqual(np.isnan(hpat_func(S)), np.isnan(test_impl(S))) - @unittest.skipIf(not sdc.config.config_pipeline_hpat_default, - "Series.sum() operator + is not implemented yet for Numba") + @skip_numba_jit("Series.sum() operator + is not implemented yet for Numba") def test_series_sum2(self): def test_impl(S): return (S + S).sum() @@ -1853,6 +1881,7 @@ def test_impl(S): S = pd.Series([np.nan, 2, 3.]) self.assertEqual(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_count1(self): def test_impl(S): return S.count() @@ -1893,7 +1922,7 @@ def test_impl(S): else: self.assertEqual(actual, expected) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, "Series.mean() any parameters unsupported") + @skip_sdc_jit("Series.mean() any parameters unsupported") def test_series_mean_skipna(self): def test_impl(S, skipna): return S.mean(skipna=skipna) @@ -1920,6 +1949,7 @@ def test_impl(S, skipna): else: self.assertEqual(actual, expected) + @skip_numba_jit def test_series_var1(self): def test_impl(S): return S.var() @@ -1943,7 +1973,7 @@ def test_impl(S): result = hpat_func(S) self.assertEqual(result, result_ref) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, "Series.min() any parameters unsupported") + @skip_sdc_jit("Series.min() any parameters unsupported") def test_series_min_param(self): def test_impl(S, param_skipna): return S.min(skipna=param_skipna) @@ -1973,7 +2003,7 @@ def test_impl(S): result = hpat_func(S) self.assertEqual(result, result_ref) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, "Series.max() any parameters unsupported") + @skip_sdc_jit("Series.max() any parameters unsupported") def test_series_max_param(self): def test_impl(S, param_skipna): return S.max(skipna=param_skipna) @@ -2064,6 +2094,7 @@ def test_impl(): hpat_func = self.jit(test_impl) pd.testing.assert_series_equal(hpat_func(), test_impl()) + @skip_numba_jit def test_series_dist_input1(self): '''Verify distribution of a Series without index''' def test_impl(S): @@ -2077,6 +2108,7 @@ def test_impl(S): self.assertEqual(count_array_REPs(), 0) self.assertEqual(count_parfor_REPs(), 0) + @skip_numba_jit def test_series_dist_input2(self): '''Verify distribution of a Series with integer index''' def test_impl(S): @@ -2129,6 +2161,7 @@ def test_impl(s_tup): h_s_tup = (S[start:end], 1, S2[start:end]) self.assertEqual(hpat_func(h_s_tup), test_impl(s_tup)) + @skip_numba_jit def test_series_rolling1(self): def test_impl(S): return S.rolling(3).sum() @@ -2137,6 +2170,7 @@ def test_impl(S): S = pd.Series([1.0, 2., 3., 4., 5.]) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_concat1(self): def test_impl(S1, S2): return pd.concat([S1, S2]).values @@ -2146,6 +2180,7 @@ def test_impl(S1, S2): S2 = pd.Series([6., 7.]) np.testing.assert_array_equal(hpat_func(S1, S2), test_impl(S1, S2)) + @skip_numba_jit def test_series_map1(self): def test_impl(S): return S.map(lambda a: 2 * a) @@ -2154,6 +2189,7 @@ def test_impl(S): S = pd.Series([1.0, 2., 3., 4., 5.]) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_map_global1(self): def test_impl(S): return S.map(lambda a: a + GLOBAL_VAL) @@ -2162,6 +2198,7 @@ def test_impl(S): S = pd.Series([1.0, 2., 3., 4., 5.]) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_map_tup1(self): def test_impl(S): return S.map(lambda a: (a, 2 * a)) @@ -2170,6 +2207,7 @@ def test_impl(S): S = pd.Series([1.0, 2., 3., 4., 5.]) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_map_tup_map1(self): def test_impl(S): A = S.map(lambda a: (a, 2 * a)) @@ -2179,6 +2217,7 @@ def test_impl(S): S = pd.Series([1.0, 2., 3., 4., 5.]) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_combine(self): def test_impl(S1, S2): return S1.combine(S2, lambda a, b: 2 * a + b) @@ -2188,6 +2227,7 @@ def test_impl(S1, S2): S2 = pd.Series([6.0, 21., 3.6, 5.]) pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) + @skip_numba_jit def test_series_combine_float3264(self): def test_impl(S1, S2): return S1.combine(S2, lambda a, b: 2 * a + b) @@ -2199,6 +2239,7 @@ def test_impl(S1, S2): np.float32(3), np.float32(4), np.float32(5)]) pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) + @skip_numba_jit def test_series_combine_assert1(self): def test_impl(S1, S2): return S1.combine(S2, lambda a, b: 2 * a + b) @@ -2209,6 +2250,7 @@ def test_impl(S1, S2): with self.assertRaises(AssertionError): hpat_func(S1, S2) + @skip_numba_jit def test_series_combine_assert2(self): def test_impl(S1, S2): return S1.combine(S2, lambda a, b: 2 * a + b) @@ -2219,6 +2261,7 @@ def test_impl(S1, S2): with self.assertRaises(AssertionError): hpat_func(S1, S2) + @skip_numba_jit def test_series_combine_integer(self): def test_impl(S1, S2): return S1.combine(S2, lambda a, b: 2 * a + b, 16) @@ -2228,6 +2271,7 @@ def test_impl(S1, S2): S2 = pd.Series([6, 21, 3, 5]) pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) + @skip_numba_jit def test_series_combine_different_types(self): def test_impl(S1, S2): return S1.combine(S2, lambda a, b: 2 * a + b) @@ -2237,6 +2281,7 @@ def test_impl(S1, S2): S2 = pd.Series([1, 2, 3, 4, 5]) pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) + @skip_numba_jit def test_series_combine_integer_samelen(self): def test_impl(S1, S2): return S1.combine(S2, lambda a, b: 2 * a + b) @@ -2246,6 +2291,7 @@ def test_impl(S1, S2): S2 = pd.Series([6, 21, 17, -5, 4]) pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) + @skip_numba_jit def test_series_combine_samelen(self): def test_impl(S1, S2): return S1.combine(S2, lambda a, b: 2 * a + b) @@ -2255,6 +2301,7 @@ def test_impl(S1, S2): S2 = pd.Series([6.0, 21., 3.6, 5., 0.0]) pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) + @skip_numba_jit def test_series_combine_value(self): def test_impl(S1, S2): return S1.combine(S2, lambda a, b: 2 * a + b, 1237.56) @@ -2264,6 +2311,7 @@ def test_impl(S1, S2): S2 = pd.Series([6.0, 21., 3.6, 5.]) pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) + @skip_numba_jit def test_series_combine_value_samelen(self): def test_impl(S1, S2): return S1.combine(S2, lambda a, b: 2 * a + b, 1237.56) @@ -2273,6 +2321,7 @@ def test_impl(S1, S2): S2 = pd.Series([6.0, 21., 3.6, 5., 0.0]) pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) + @skip_numba_jit def test_series_apply1(self): def test_impl(S): return S.apply(lambda a: 2 * a) @@ -2289,6 +2338,7 @@ def test_impl(S): S = pd.Series([np.nan, -2., 3., 0.5E-01, 0xFF, 0o7, 0b101]) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_cov1(self): def test_impl(S1, S2): return S1.cov(S2) @@ -2300,6 +2350,7 @@ def test_impl(S1, S2): hpat_func(S1, S2), test_impl(S1, S2), err_msg='S1={}\nS2={}'.format(S1, S2)) + @skip_numba_jit def test_series_corr1(self): def test_impl(S1, S2): return S1.corr(S2) @@ -2311,6 +2362,7 @@ def test_impl(S1, S2): hpat_func(S1, S2), test_impl(S1, S2), err_msg='S1={}\nS2={}'.format(S1, S2)) + @skip_numba_jit def test_series_str_len1(self): def test_impl(S): return S.str.len() @@ -2319,6 +2371,7 @@ def test_impl(S): S = pd.Series(['aa', 'abc', 'c', 'cccd']) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_str2str(self): common_methods = ['lower', 'upper', 'lstrip', 'rstrip', 'strip'] sdc_methods = ['capitalize', 'swapcase', 'title'] @@ -2338,8 +2391,7 @@ def test_series_str2str(self): pd.testing.assert_series_equal(hpat_func(S), test_impl(S), check_names=method in common_methods) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.str.() unsupported') + @skip_sdc_jit('Series.str.() unsupported') def test_series_str2str_unsupported(self): unsupported_methods = ['capitalize', 'swapcase', 'title'] for method in unsupported_methods: @@ -2356,8 +2408,7 @@ def test_series_str2str_unsupported(self): expected_msg = 'Series.str.{} is not supported yet'.format(method) self.assertIn(expected_msg, str(raises.exception)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "Old-style append implementation doesn't handle ignore_index argument") + @skip_sdc_jit("Old-style append implementation doesn't handle ignore_index argument") def test_series_append_single_ignore_index(self): '''Verify Series.append() concatenates Series with other single Series ignoring indexes''' def test_impl(S, other): @@ -2372,8 +2423,7 @@ def test_impl(S, other): S1, S2 = [pd.Series(data) for data in data_list] pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "Old-style append implementation doesn't handle ignore_index argument") + @skip_sdc_jit("Old-style append implementation doesn't handle ignore_index argument") def test_series_append_list_ignore_index(self): '''Verify Series.append() concatenates Series with list of other Series ignoring indexes''' def test_impl(S1, S2, S3): @@ -2405,8 +2455,7 @@ def test_impl(S1, S2, S3): S1, S2, S3 = [pd.Series(data) for data in data_list] pd.testing.assert_series_equal(hpat_func(S1, S2, S3), test_impl(S1, S2, S3)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "BUG: old-style append implementation doesn't handle series index") + @skip_sdc_jit("BUG: old-style append implementation doesn't handle series index") def test_series_append_single_index_default(self): '''Verify Series.append() concatenates Series with other single Series respecting default indexes''' def test_impl(S, other): @@ -2422,8 +2471,7 @@ def test_impl(S, other): S1, S2 = [pd.Series(data) for data in data_list] pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "BUG: old-style append implementation doesn't handle series index") + @skip_sdc_jit("BUG: old-style append implementation doesn't handle series index") def test_series_append_list_index_default(self): '''Verify Series.append() concatenates Series with list of other Series respecting default indexes''' def test_impl(S1, S2, S3): @@ -2455,8 +2503,7 @@ def test_impl(S1, S2, S3): S1, S2, S3 = [pd.Series(data) for data in data_list] pd.testing.assert_series_equal(hpat_func(S1, S2, S3), test_impl(S1, S2, S3)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "BUG: old-style append implementation doesn't handle series index") + @skip_sdc_jit("BUG: old-style append implementation doesn't handle series index") def test_series_append_single_index_int(self): '''Verify Series.append() concatenates Series with other single Series respecting integer indexes''' def test_impl(S, other): @@ -2473,8 +2520,7 @@ def test_impl(S, other): S1, S2 = [pd.Series(data, index=indexes[i]) for i, data in enumerate(data_list)] pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "BUG: old-style append implementation doesn't handle series index") + @skip_sdc_jit("BUG: old-style append implementation doesn't handle series index") def test_series_append_list_index_int(self): '''Verify Series.append() concatenates Series with list of other Series respecting integer indexes''' def test_impl(S1, S2, S3): @@ -2508,8 +2554,7 @@ def test_impl(S1, S2, S3): S1, S2, S3 = [pd.Series(data, index=indexes[i]) for i, data in enumerate(data_list)] pd.testing.assert_series_equal(hpat_func(S1, S2, S3), test_impl(S1, S2, S3)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "BUG: old-style append implementation doesn't handle series index") + @skip_sdc_jit("BUG: old-style append implementation doesn't handle series index") def test_series_append_single_index_str(self): '''Verify Series.append() concatenates Series with other single Series respecting string indexes''' def test_impl(S, other): @@ -2526,8 +2571,7 @@ def test_impl(S, other): S1, S2 = [pd.Series(data, index=indexes[i]) for i, data in enumerate(data_list)] pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "BUG: old-style append implementation doesn't handle series index") + @skip_sdc_jit("BUG: old-style append implementation doesn't handle series index") def test_series_append_list_index_str(self): '''Verify Series.append() concatenates Series with list of other Series respecting string indexes''' def test_impl(S1, S2, S3): @@ -2561,8 +2605,7 @@ def test_impl(S1, S2, S3): S1, S2, S3 = [pd.Series(data, index=indexes[i]) for i, data in enumerate(data_list)] pd.testing.assert_series_equal(hpat_func(S1, S2, S3), test_impl(S1, S2, S3)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "Old-style append implementation doesn't handle ignore_index argument") + @skip_sdc_jit("Old-style append implementation doesn't handle ignore_index argument") def test_series_append_ignore_index_literal(self): '''Verify Series.append() implementation handles ignore_index argument as Boolean literal''' def test_impl(S, other): @@ -2573,8 +2616,7 @@ def test_impl(S, other): S2 = pd.Series([-2., 5.0], ['a2', 'b2']) pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "Old-style append implementation doesn't handle ignore_index argument") + @skip_sdc_jit("Old-style append implementation doesn't handle ignore_index argument") def test_series_append_ignore_index_non_literal(self): '''Verify Series.append() implementation raises if ignore_index argument is not a Boolean literal''' def test_impl(S, other, param): @@ -2589,8 +2631,7 @@ def test_impl(S, other, param): msg = 'Method append(). The ignore_index must be a literal Boolean constant. Given: {}' self.assertIn(msg.format(types.bool_), str(raises.exception)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "BUG: old-style append implementation doesn't handle series index") + @skip_sdc_jit("BUG: old-style append implementation doesn't handle series index") def test_series_append_single_dtype_promotion(self): '''Verify Series.append() implementation handles appending single Series with different dtypes''' def test_impl(S, other): @@ -2601,8 +2642,7 @@ def test_impl(S, other): S2 = pd.Series([-2, 5], ['a2', 'b2']) pd.testing.assert_series_equal(hpat_func(S1, S2), test_impl(S1, S2)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "BUG: old-style append implementation doesn't handle series index") + @skip_sdc_jit("BUG: old-style append implementation doesn't handle series index") def test_series_append_list_dtype_promotion(self): '''Verify Series.append() implementation handles appending list of Series with different dtypes''' def test_impl(S1, S2, S3): @@ -2784,6 +2824,7 @@ def test_impl(S): S = pd.Series([pd.NaT, pd.Timestamp('1970-12-01'), pd.Timestamp('2012-07-25')]) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_nlargest(self): def test_impl(): series = pd.Series([1., np.nan, -1., 0., min_float64, max_float64]) @@ -2795,6 +2836,7 @@ def test_impl(): else: pd.testing.assert_series_equal(test_impl(), hpat_func()) + @skip_numba_jit def test_series_nlargest_unboxing(self): def test_impl(series, n): return series.nlargest(n) @@ -2810,8 +2852,7 @@ def test_impl(series, n): else: pd.testing.assert_series_equal(ref_result, jit_result) - @unittest.skipIf(not sdc.config.config_pipeline_hpat_default, - 'Series.nlargest() parallelism unsupported') + @skip_numba_jit('Series.nlargest() parallelism unsupported and parquet not supported') def test_series_nlargest_parallel(self): # create `kde.parquet` file ParquetGenerator.gen_kde_pq() @@ -2829,8 +2870,7 @@ def test_impl(): self.assertEqual(count_parfor_REPs(), 0) self.assertTrue(count_array_OneDs() > 0) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.nlargest() parameter keep unsupported') + @skip_sdc_jit('Series.nlargest() parameter keep unsupported') def test_series_nlargest_full(self): def test_impl(series, n, keep): return series.nlargest(n, keep) @@ -2844,6 +2884,7 @@ def test_impl(series, n, keep): jit_result = hpat_func(series, n, keep) pd.testing.assert_series_equal(ref_result, jit_result) + @skip_numba_jit def test_series_nlargest_index(self): def test_impl(series, n): return series.nlargest(n) @@ -2867,8 +2908,7 @@ def test_impl(series, n): else: pd.testing.assert_series_equal(ref_result, jit_result) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.nlargest() does not raise an exception') + @skip_sdc_jit('Series.nlargest() does not raise an exception') def test_series_nlargest_typing(self): _func_name = 'Method nlargest().' @@ -2891,8 +2931,7 @@ def test_impl(series, n, keep): msg = '{} The object keep\n given: {}\n expected: str' self.assertIn(msg.format(_func_name, dtype), str(raises.exception)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.nlargest() does not raise an exception') + @skip_sdc_jit('Series.nlargest() does not raise an exception') def test_series_nlargest_unsupported(self): msg = "Method nlargest(). Unsupported parameter. Given 'keep' != 'first'" @@ -2910,6 +2949,7 @@ def test_impl(series, n, keep): hpat_func(series, n=5, keep='last') self.assertIn(msg, str(raises.exception)) + @skip_numba_jit def test_series_nsmallest(self): def test_impl(): series = pd.Series([1., np.nan, -1., 0., min_float64, max_float64]) @@ -2921,6 +2961,7 @@ def test_impl(): else: pd.testing.assert_series_equal(test_impl(), hpat_func()) + @skip_numba_jit def test_series_nsmallest_unboxing(self): def test_impl(series, n): return series.nsmallest(n) @@ -2936,8 +2977,7 @@ def test_impl(series, n): else: pd.testing.assert_series_equal(ref_result, jit_result) - @unittest.skipIf(not sdc.config.config_pipeline_hpat_default, - 'Series.nsmallest() parallelism unsupported') + @skip_numba_jit('Series.nsmallest() parallelism unsupported and parquet not supported') def test_series_nsmallest_parallel(self): # create `kde.parquet` file ParquetGenerator.gen_kde_pq() @@ -2955,8 +2995,7 @@ def test_impl(): self.assertEqual(count_parfor_REPs(), 0) self.assertTrue(count_array_OneDs() > 0) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.nsmallest() parameter keep unsupported') + @skip_sdc_jit('Series.nsmallest() parameter keep unsupported') def test_series_nsmallest_full(self): def test_impl(series, n, keep): return series.nsmallest(n, keep) @@ -2970,6 +3009,7 @@ def test_impl(series, n, keep): jit_result = hpat_func(series, n, keep) pd.testing.assert_series_equal(ref_result, jit_result) + @skip_numba_jit def test_series_nsmallest_index(self): def test_impl(series, n): return series.nsmallest(n) @@ -2993,8 +3033,7 @@ def test_impl(series, n): else: pd.testing.assert_series_equal(ref_result, jit_result) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.nsmallest() does not raise an exception') + @skip_sdc_jit('Series.nsmallest() does not raise an exception') def test_series_nsmallest_typing(self): _func_name = 'Method nsmallest().' @@ -3017,8 +3056,7 @@ def test_impl(series, n, keep): msg = '{} The object keep\n given: {}\n expected: str' self.assertIn(msg.format(_func_name, dtype), str(raises.exception)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.nsmallest() does not raise an exception') + @skip_sdc_jit('Series.nsmallest() does not raise an exception') def test_series_nsmallest_unsupported(self): msg = "Method nsmallest(). Unsupported parameter. Given 'keep' != 'first'" @@ -3036,6 +3074,7 @@ def test_impl(series, n, keep): hpat_func(series, n=5, keep='last') self.assertIn(msg, str(raises.exception)) + @skip_numba_jit def test_series_head1(self): def test_impl(S): return S.head(4) @@ -3046,6 +3085,7 @@ def test_impl(S): S = pd.Series(np.random.randint(-30, 30, m)) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_head_default1(self): '''Verifies default head method for non-distributed pass of Series with no index''' def test_impl(S): @@ -3057,6 +3097,7 @@ def test_impl(S): S = pd.Series(np.random.randint(-30, 30, m)) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_head_index1(self): '''Verifies head method for Series with integer index created inside jitted function''' def test_impl(): @@ -3066,6 +3107,7 @@ def test_impl(): pd.testing.assert_series_equal(hpat_func(), test_impl()) + @skip_numba_jit def test_series_head_index2(self): '''Verifies head method for Series with string index created inside jitted function''' def test_impl(): @@ -3075,6 +3117,7 @@ def test_impl(): pd.testing.assert_series_equal(hpat_func(), test_impl()) + @skip_numba_jit def test_series_head_index3(self): '''Verifies head method for non-distributed pass of Series with integer index''' def test_impl(S): @@ -3094,6 +3137,7 @@ def test_impl(S): S = pd.Series([6, 9, 2, 4, 6, 4, 5], ['a', 'ab', 'abc', 'c', 'f', 'hh', '']) pd.testing.assert_series_equal(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_series_head_parallel1(self): '''Verifies head method for distributed Series with string data and no index''' def test_impl(S): @@ -3109,6 +3153,7 @@ def test_impl(S): pd.testing.assert_series_equal(hpat_func(S[start:end]), test_impl(S)) self.assertTrue(count_array_OneDs() > 0) + @skip_numba_jit def test_series_head_index_parallel1(self): '''Verifies head method for distributed Series with integer index''' def test_impl(S): @@ -3132,6 +3177,7 @@ def test_impl(S): pd.testing.assert_series_equal(hpat_func(S[start:end]), test_impl(S)) self.assertTrue(count_array_OneDs() > 0) + @skip_numba_jit def test_series_head_noidx_float(self): def test_impl(S, n): return S.head(n) @@ -3234,8 +3280,7 @@ def test_impl(S): S = pd.Series(np.random.ranf(m)) self.assertEqual(hpat_func(S), test_impl(S)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "BUG: old-style median implementation doesn't filter NaNs") + @skip_sdc_jit("BUG: old-style median implementation doesn't filter NaNs") def test_series_median_skipna_default1(self): '''Verifies median implementation with default skipna=True argument on a series with NA values''' def test_impl(S): @@ -3245,8 +3290,7 @@ def test_impl(S): S = pd.Series([2., 3., 5., np.nan, 5., 6., 7.]) self.assertEqual(hpat_func(S), test_impl(S)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - "Skipna argument is not supported in old-style") + @skip_sdc_jit("Skipna argument is not supported in old-style") def test_series_median_skipna_false1(self): '''Verifies median implementation with skipna=False on a series with NA values''' def test_impl(S): @@ -3262,6 +3306,7 @@ def test_impl(S): S2 = pd.Series([2., 3., 5., np.nan, 5., 6., 7.]) self.assertEqual(np.isnan(hpat_func(S2)), np.isnan(test_impl(S2))) + @skip_numba_jit def test_series_median_parallel1(self): # create `kde.parquet` file ParquetGenerator.gen_kde_pq() @@ -3277,6 +3322,7 @@ def test_impl(): self.assertEqual(count_parfor_REPs(), 0) self.assertTrue(count_array_OneDs() > 0) + @skip_numba_jit def test_series_argsort_parallel(self): # create `kde.parquet` file ParquetGenerator.gen_kde_pq() @@ -3542,6 +3588,7 @@ def test_impl(series, ascending, kind): np.testing.assert_array_equal(ref_result.data, jit_result.data) self.assertEqual(ref, jit) + @skip_numba_jit def test_series_sort_values_parallel1(self): # create `kde.parquet` file ParquetGenerator.gen_kde_pq() @@ -3815,7 +3862,7 @@ def test_impl(): hpat_func = self.jit(test_impl) np.testing.assert_equal(hpat_func(), test_impl()) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, "Series.quantile() parameter as a list unsupported") + @skip_sdc_jit("Series.quantile() parameter as a list unsupported") def test_series_quantile_q_vector(self): def test_series_quantile_q_vector_impl(S, param1): return S.quantile(param1) @@ -3859,6 +3906,7 @@ def test_impl(): result = hpat_func().size np.testing.assert_array_equal(ref_result, result) + @skip_numba_jit def test_series_groupby_count(self): def test_impl(): A = pd.Series([13, 11, 21, 13, 13, 51, 42, 21]) @@ -3884,6 +3932,7 @@ def test_impl(): result = hpat_func() np.testing.assert_array_equal(result, ref_result) + @skip_numba_jit def test_series_std(self): def pyfunc(): series = pd.Series([1.0, np.nan, -1.0, 0.0, 5e-324]) @@ -3894,8 +3943,7 @@ def pyfunc(): result = cfunc() np.testing.assert_equal(ref_result, result) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.std() parameters "skipna" and "ddof" unsupported') + @skip_sdc_jit('Series.std() parameters "skipna" and "ddof" unsupported') def test_series_std_unboxing(self): def pyfunc(series, skipna, ddof): return series.std(skipna=skipna, ddof=ddof) @@ -3909,8 +3957,7 @@ def pyfunc(series, skipna, ddof): result = cfunc(series, skipna=skipna, ddof=ddof) np.testing.assert_equal(ref_result, result) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.std() strings as input data unsupported') + @skip_sdc_jit('Series.std() strings as input data unsupported') def test_series_std_str(self): def pyfunc(series): return series.std() @@ -3922,8 +3969,7 @@ def pyfunc(series): msg = 'Method std(). The object must be a number. Given self.data.dtype: {}' self.assertIn(msg.format(types.unicode_type), str(raises.exception)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.std() parameters "axis", "level", "numeric_only" unsupported') + @skip_sdc_jit('Series.std() parameters "axis", "level", "numeric_only" unsupported') def test_series_std_unsupported_params(self): def pyfunc(series, axis, level, numeric_only): return series.std(axis=axis, level=level, numeric_only=numeric_only) @@ -3943,6 +3989,7 @@ def pyfunc(series, axis, level, numeric_only): cfunc(series, axis=None, level=None, numeric_only=True) self.assertIn(msg.format('numeric_only', 'bool'), str(raises.exception)) + @skip_numba_jit def test_series_nunique(self): def test_series_nunique_impl(S): return S.nunique() @@ -3999,6 +4046,7 @@ def test_series_nunique_param1_impl(S, dropna): result_param1 = hpat_func_param1(S, param1) self.assertEqual(result_param1, result_param1_ref) + @skip_numba_jit def test_series_var(self): def pyfunc(): series = pd.Series([1.0, np.nan, -1.0, 0.0, 5e-324]) @@ -4007,8 +4055,7 @@ def pyfunc(): cfunc = self.jit(pyfunc) np.testing.assert_equal(pyfunc(), cfunc()) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.var() data [max_uint64, max_uint64] unsupported') + @skip_sdc_jit('Series.var() data [max_uint64, max_uint64] unsupported') def test_series_var_unboxing(self): def pyfunc(series): return series.var() @@ -4018,8 +4065,7 @@ def pyfunc(series): series = pd.Series(data) np.testing.assert_equal(pyfunc(series), cfunc(series)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.var() parameters "ddof" and "skipna" unsupported') + @skip_sdc_jit('Series.var() parameters "ddof" and "skipna" unsupported') def test_series_var_full(self): def pyfunc(series, skipna, ddof): return series.var(skipna=skipna, ddof=ddof) @@ -4033,8 +4079,7 @@ def pyfunc(series, skipna, ddof): result = cfunc(series, skipna=skipna, ddof=ddof) np.testing.assert_equal(ref_result, result) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.var() strings as input data unsupported') + @skip_sdc_jit('Series.var() strings as input data unsupported') def test_series_var_str(self): def pyfunc(series): return series.var() @@ -4046,8 +4091,7 @@ def pyfunc(series): msg = 'Method var(). The object must be a number. Given self.data.dtype: {}' self.assertIn(msg.format(types.unicode_type), str(raises.exception)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.var() parameters "axis", "level", "numeric_only" unsupported') + @skip_sdc_jit('Series.var() parameters "axis", "level", "numeric_only" unsupported') def test_series_var_unsupported_params(self): def pyfunc(series, axis, level, numeric_only): return series.var(axis=axis, level=level, numeric_only=numeric_only) @@ -4096,8 +4140,7 @@ def test_series_count_impl(S): self.assertEqual(result, result_ref) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.cumsum() np.nan as input data unsupported') + @skip_sdc_jit('Series.cumsum() np.nan as input data unsupported') def test_series_cumsum(self): def test_impl(): series = pd.Series([1.0, np.nan, -1.0, 0.0, 5e-324]) @@ -4107,8 +4150,7 @@ def test_impl(): cfunc = self.jit(pyfunc) pd.testing.assert_series_equal(pyfunc(), cfunc()) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.cumsum() np.nan as input data unsupported') + @skip_sdc_jit('Series.cumsum() np.nan as input data unsupported') def test_series_cumsum_unboxing(self): def test_impl(s): return s.cumsum() @@ -4120,8 +4162,7 @@ def test_impl(s): series = pd.Series(data) pd.testing.assert_series_equal(pyfunc(series), cfunc(series)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.cumsum() parameters "axis", "skipna" unsupported') + @skip_sdc_jit('Series.cumsum() parameters "axis", "skipna" unsupported') def test_series_cumsum_full(self): def test_impl(s, axis, skipna): return s.cumsum(axis=axis, skipna=skipna) @@ -4137,8 +4178,7 @@ def test_impl(s, axis, skipna): jit_result = cfunc(series, axis=axis, skipna=skipna) pd.testing.assert_series_equal(ref_result, jit_result) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.cumsum() strings as input data unsupported') + @skip_sdc_jit('Series.cumsum() strings as input data unsupported') def test_series_cumsum_str(self): def test_impl(s): return s.cumsum() @@ -4150,8 +4190,7 @@ def test_impl(s): msg = 'Method cumsum(). The object must be a number. Given self.data.dtype: {}' self.assertIn(msg.format(types.unicode_type), str(raises.exception)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.cumsum() parameter "axis" unsupported') + @skip_sdc_jit('Series.cumsum() parameter "axis" unsupported') def test_series_cumsum_unsupported_axis(self): def test_impl(s, axis): return s.cumsum(axis=axis) @@ -4164,8 +4203,7 @@ def test_impl(s, axis): msg = 'Method cumsum(). Unsupported parameters. Given axis: int' self.assertIn(msg, str(raises.exception)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.cov() parameter "min_periods" unsupported') + @skip_sdc_jit('Series.cov() parameter "min_periods" unsupported') def test_series_cov(self): def test_series_cov_impl(S1, S2, min_periods=None): return S1.cov(S2, min_periods) @@ -4192,8 +4230,7 @@ def test_series_cov_impl(S1, S2, min_periods=None): result = hpat_func(S1, S2, min_periods=period) np.testing.assert_allclose(result, result_ref) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.cov() parameter "min_periods" unsupported') + @skip_sdc_jit('Series.cov() parameter "min_periods" unsupported') def test_series_cov_unsupported_dtype(self): def test_series_cov_impl(S1, S2, min_periods=None): return S1.cov(S2, min_periods=min_periods) @@ -4214,8 +4251,7 @@ def test_series_cov_impl(S1, S2, min_periods=None): msg = 'Method cov(). The object self.data' self.assertIn(msg, str(raises.exception)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.cov() parameter "min_periods" unsupported') + @skip_sdc_jit('Series.cov() parameter "min_periods" unsupported') def test_series_cov_unsupported_period(self): def test_series_cov_impl(S1, S2, min_periods=None): return S1.cov(S2, min_periods) @@ -4234,8 +4270,8 @@ def test_series_cov_impl(S1, S2, min_periods=None): msg = 'Method cov(). The object min_periods' self.assertIn(msg, str(raises.exception)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.pct_change unsupported some Series') + @skip_numba_jit + @skip_sdc_jit('Series.pct_change unsupported some Series') def test_series_pct_change(self): def test_series_pct_change_impl(S, periods, method): return S.pct_change(periods=periods, fill_method=method, limit=None, freq=None) @@ -4258,8 +4294,7 @@ def test_series_pct_change_impl(S, periods, method): result = hpat_func(S, periods, method) pd.testing.assert_series_equal(result, result_ref) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.pct_change() strings as input data unsupported') + @skip_sdc_jit('Series.pct_change() strings as input data unsupported') def test_series_pct_change_str(self): def test_series_pct_change_impl(S): return S.pct_change(periods=1, fill_method='pad', limit=None, freq=None) @@ -4272,8 +4307,7 @@ def test_series_pct_change_impl(S): msg = 'Method pct_change(). The object self.data' self.assertIn(msg, str(raises.exception)) - @unittest.skipIf(sdc.config.config_pipeline_hpat_default, - 'Series.pct_change() does not raise an exception') + @skip_sdc_jit('Series.pct_change() does not raise an exception') def test_series_pct_change_not_supported(self): def test_series_pct_change_impl(S, periods=1, fill_method='pad', limit=None, freq=None): return S.pct_change(periods=periods, fill_method=fill_method, limit=limit, freq=freq) @@ -4306,146 +4340,5 @@ def test_series_pct_change_impl(S, periods=1, fill_method='pad', limit=None, fre self.assertIn(msg, str(raises.exception)) -# Sort Lines Ascending -_numba_not_supported_tests = [ - "test_create_str", - "test_create1", - "test_create2", - "test_getitem_series_str1", - "test_getitem_series1", - "test_list_convert", - "test_np_call_on_series1", - "test_pass_df_str", - "test_pass_df1", - "test_pass_series_str", - "test_pass_series1", - "test_pass_series2", - "test_series_apply1", - "test_series_argsort_parallel", - "test_series_astype_float_to_int32", - "test_series_astype_int_to_float64", - "test_series_astype_int_to_str1", - "test_series_astype_int_to_str2", - "test_series_astype_int32_to_int64", - "test_series_astype_str_index_int", - "test_series_astype_str_index_str", - "test_series_astype_str_to_str_index_int", - "test_series_astype_str_to_str_index_str", - "test_series_astype_str_to_str1", - "test_series_astype_str_to_str2", - "test_series_attr7", - "test_series_combine_assert1", - "test_series_combine_assert2", - "test_series_combine_different_types", - "test_series_combine_float3264", - "test_series_combine_integer_samelen", - "test_series_combine_integer", - "test_series_combine_samelen", - "test_series_combine_value_samelen", - "test_series_combine_value", - "test_series_combine", - "test_series_concat1", - "test_series_corr1", - "test_series_count1", - "test_series_cov1", - "test_series_dist_input1", - "test_series_dist_input2", - "test_series_dropna_bool_no_index1", - "test_series_dropna_str_parallel1", - "test_series_fillna_bool_no_index1", - "test_series_fillna_float_inplace3", - "test_series_fillna_inplace_non_literal", - "test_series_fillna_str_inplace_empty1", - "test_series_fillna_str_inplace1", - "test_series_fusion1", - "test_series_fusion2", - "test_series_head_default1", - "test_series_head_index_parallel1", - "test_series_head_index1", - "test_series_head_index2", - "test_series_head_index3", - "test_series_head_noidx_float", - "test_series_head_parallel1", - "test_series_head1", - "test_series_iat1", - "test_series_iat2", - "test_series_iloc1", - "test_series_iloc2", - "test_series_inplace_binop_array", - "test_series_list_str_unbox1", - "test_series_map_global1", - "test_series_map_tup_map1", - "test_series_map_tup1", - "test_series_map1", - "test_series_median_parallel1", - "test_series_nlargest_index", - "test_series_nlargest_parallel", - "test_series_nlargest_unboxing", - "test_series_nlargest", - "test_series_nsmallest_index", - "test_series_nsmallest_parallel", - "test_series_nsmallest_unboxing", - "test_series_nsmallest", - "test_series_op1", - "test_series_op2", - "test_series_op3", - "test_series_op4", - "test_series_op6", - "test_series_op7", - "test_series_rolling1", - "test_series_sort_values_parallel1", - "test_series_std", - "test_series_str_len1", - "test_series_str2str", - "test_series_sum2", - "test_series_ufunc1", - "test_series_values1", - "test_series_var", - "test_series_var1", - "test_setitem_series_bool1", - "test_setitem_series_bool2", - "test_setitem_series1", - "test_setitem_series2", - "test_static_getitem_series1", - "test_static_setitem_series1", -] - - -def decorate_methods(decorator, methods): - """Decorator for classes. It adds new methods decorated with given decorator. - It is useful for skipping tests from a base class. - - Example: - class MyTestBase(unittest.TestCase): - def test_mytest(self): - ... - - @decorate_methods(unittest.skip("my reason"), ["test_mytest"]) - class MyTest(MyTestBase): - pass - """ - - def decorate(cls): - def _func(self): pass - for attr in methods: - setattr(cls, attr, decorator(_func)) - return cls - return decorate - - -@decorate_methods(unittest.skip("numba not supported"), _numba_not_supported_tests) -class TestSeriesNumba(TestSeries): - - def jit(self, *args, **kwargs): - import numba - import warnings - if 'nopython' in kwargs: - warnings.warn('nopython is set to True and is ignored', RuntimeWarning) - if 'parallel' in kwargs: - warnings.warn('parallel is set to True and is ignored', RuntimeWarning) - kwargs.update({'nopython': True, 'parallel': True}) - return numba.jit(*args, **kwargs) - - if __name__ == "__main__": unittest.main() diff --git a/sdc/tests/test_strings.py b/sdc/tests/test_strings.py index dc92d6b6f..8921389ba 100644 --- a/sdc/tests/test_strings.py +++ b/sdc/tests/test_strings.py @@ -39,9 +39,9 @@ from sdc.str_arr_ext import StringArray from sdc.str_ext import unicode_to_std_str, std_str_to_unicode from sdc.tests.gen_test_data import ParquetGenerator +from sdc.tests.test_utils import skip_numba_jit, TestCase - -class TestStrings(unittest.TestCase): +class TestStrings(TestCase): def test_pass_return(self): def test_impl(_str): @@ -62,6 +62,7 @@ def test_impl(): hpat_func = sdc.jit(test_impl) self.assertEqual(hpat_func(), test_impl()) + @skip_numba_jit def test_str2str(self): str2str_methods = ['capitalize', 'casefold', 'lower', 'lstrip', 'rstrip', 'strip', 'swapcase', 'title', 'upper'] @@ -212,6 +213,7 @@ def test_impl(): self.assertTrue(np.array_equal(hpat_func(), ['ABC', 'BB', 'CDEF'])) + @skip_numba_jit def test_string_array_comp(self): def test_impl(): A = StringArray(['ABC', 'BB', 'CDEF']) @@ -221,6 +223,7 @@ def test_impl(): self.assertEqual(hpat_func(), 1) + @skip_numba_jit def test_string_series(self): def test_impl(ds): rs = ds == 'one' @@ -238,6 +241,7 @@ def test_impl(ds): self.assertTrue(isinstance(ds, pd.Series) and isinstance(rs, pd.Series)) self.assertTrue(ds[0] == 'one' and ds[2] == 'three' and rs[0] and not rs[2]) + @skip_numba_jit def test_string_array_bool_getitem(self): def test_impl(): A = StringArray(['ABC', 'BB', 'CDEF']) @@ -248,6 +252,7 @@ def test_impl(): self.assertEqual(hpat_func(), True) + @skip_numba_jit def test_string_NA_box(self): # create `example.parquet` file ParquetGenerator.gen_pq_test() @@ -262,6 +267,7 @@ def test_impl(): np.testing.assert_array_equal(hpat_func().isna(), test_impl().isna()) # test utf8 decode + @skip_numba_jit def test_decode_empty1(self): def test_impl(S): return S[0] @@ -270,6 +276,7 @@ def test_impl(S): S = pd.Series(['']) self.assertEqual(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_decode_single_ascii_char1(self): def test_impl(S): return S[0] @@ -278,6 +285,7 @@ def test_impl(S): S = pd.Series(['A']) self.assertEqual(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_decode_ascii1(self): def test_impl(S): return S[0] @@ -286,6 +294,7 @@ def test_impl(S): S = pd.Series(['Abc12', 'bcd', '345']) self.assertEqual(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_decode_unicode1(self): def test_impl(S): return S[0], S[1], S[2] @@ -295,6 +304,7 @@ def test_impl(S): '🐍⚡', '大处着眼,小处着手。', ]) self.assertEqual(hpat_func(S), test_impl(S)) + @skip_numba_jit def test_decode_unicode2(self): # test strings that start with ascii def test_impl(S): diff --git a/sdc/tests/test_utils.py b/sdc/tests/test_utils.py index 7e799c592..798359d86 100644 --- a/sdc/tests/test_utils.py +++ b/sdc/tests/test_utils.py @@ -25,6 +25,8 @@ # EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # ***************************************************************************** +import unittest + import numpy as np import sdc @@ -108,3 +110,55 @@ def get_start_end(n): def check_numba_version(version): return numba.__version__ == version + + +def msg_and_func(msg_or_func=None): + if msg_or_func is None: + # No signature, no function + func = None + msg = None + elif isinstance(msg_or_func, str): + # A message is passed + func = None + msg = msg_or_func + else: + # A function is passed + func = msg_or_func + msg = None + return msg, func + + +def skip_numba_jit(msg_or_func=None): + msg, func = msg_and_func(msg_or_func) + wrapper = unittest.skipUnless(sdc.config.config_pipeline_hpat_default, msg or "numba pipeline not supported") + # wrapper = lambda f: f # disable skipping + return wrapper(func) if func else wrapper + + +def skip_sdc_jit(msg_or_func=None): + msg, func = msg_and_func(msg_or_func) + wrapper = unittest.skipIf(sdc.config.config_pipeline_hpat_default, msg or "sdc pipeline not supported") + # wrapper = lambda f: f # disable skipping + return wrapper(func) if func else wrapper + + +class TestCase(unittest.TestCase): + + def numba_jit(self, *args, **kwargs): + import numba + import warnings + if 'nopython' in kwargs: + warnings.warn('nopython is set to True and is ignored', RuntimeWarning) + if 'parallel' in kwargs: + warnings.warn('parallel is set to True and is ignored', RuntimeWarning) + kwargs.update({'nopython': True, 'parallel': True}) + return numba.jit(*args, **kwargs) + + def sdc_jit(self, *args, **kwargs): + return sdc.jit(*args, **kwargs) + + def jit(self, *args, **kwargs): + if sdc.config.config_pipeline_hpat_default: + return self.sdc_jit(*args, **kwargs) + else: + return self.numba_jit(*args, **kwargs)