Skip to content
This repository was archived by the owner on Feb 2, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
change message error
  • Loading branch information
Rubtsowa committed Apr 3, 2020
commit 0b2af26bf8cad908c2f9de38bd15d71c9bab1c41
7 changes: 4 additions & 3 deletions sdc/datatypes/hpat_pandas_stringmethods_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,14 @@ def hpat_pandas_stringmethods_upper_impl(self):

import numba
from numba.types import (Boolean, Integer, NoneType,
Omitted, StringLiteral, UnicodeType, Number, Set)
Omitted, StringLiteral, UnicodeType)

from sdc.utilities.sdc_typing_utils import TypeChecker
from sdc.datatypes.hpat_pandas_stringmethods_types import StringMethodsType
from sdc.utilities.utils import sdc_overload_method, sdc_register_jitable
from sdc.hiframes.api import get_nan_mask
from sdc.str_arr_ext import str_arr_set_na_by_mask, create_str_arr_from_list
from sdc.datatypes.common_functions import SDCLimitation


@sdc_overload_method(StringMethodsType, 'center')
Expand Down Expand Up @@ -212,10 +213,10 @@ def hpat_pandas_stringmethods_contains(self, pat, case=True, flags=0, na=None, r

def hpat_pandas_stringmethods_contains_impl(self, pat, case=True, flags=0, na=None, regex=True):
if flags != 0:
raise ValueError('Parameter flags can be only 0.')
raise SDCLimitation("Method contains(). Unsupported parameter. Given 'flags' != 0")

if not regex:
raise ValueError('Parameter regex can be only True.')
raise SDCLimitation("Method contains(). Unsupported parameter. Given 'regex' is False")

if not case:
_pat = pat.lower()
Expand Down
11 changes: 6 additions & 5 deletions sdc/tests/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
from sdc.tests.gen_test_data import ParquetGenerator

from sdc.tests.test_utils import test_global_input_data_unicode_kind1
from sdc.datatypes.common_functions import SDCLimitation


_cov_corr_series = [(pd.Series(x), pd.Series(y)) for x, y in [
Expand Down Expand Up @@ -6117,19 +6118,19 @@ def test_series_contains_unsupported(self):
s = pd.Series(['Mouse', 'dog', 'house and parrot', '23'])
pat = 'og'

with self.assertRaises(ValueError) as raises:
with self.assertRaises(SDCLimitation) as raises:
hpat_func(s, pat, flags=1)
msg = 'Parameter flags can be only 0'
msg = "Method contains(). Unsupported parameter. Given 'flags' != 0"
self.assertIn(msg, str(raises.exception))

with self.assertRaises(TypingError) as raises:
hpat_func(s, pat, na=0)
msg = 'Method contains(). The object na'
msg = 'Method contains(). The object na\n given: int64\n expected: none'
self.assertIn(msg, str(raises.exception))

with self.assertRaises(ValueError) as raises:
with self.assertRaises(SDCLimitation) as raises:
hpat_func(s, pat, regex=False)
msg = 'Parameter regex can be only True'
msg = "Method contains(). Unsupported parameter. Given 'regex' is False"
self.assertIn(msg, str(raises.exception))

@skip_sdc_jit('Old-style implementation returns string, but not series')
Expand Down