@@ -2480,17 +2480,16 @@ def test_impl(series, sub, start):
24802480 hpat_func = self .jit (test_impl )
24812481
24822482 series = pd .Series (test_global_input_data_unicode_kind4 )
2483- msg_tmpl = 'Method {} (). The object {} \n {}'
2483+ msg_tmpl = 'Method find (). The object start \n {}'
24842484
24852485 with self .assertRaises (TypingError ) as raises :
24862486 hpat_func (series , '' , '0' )
2487- msg = msg_tmpl .format ('find' , 'start' , 'given: unicode_type\n '
2488- 'expected: None, int' )
2487+ msg = msg_tmpl .format ('given: unicode_type\n expected: None, int' )
24892488 self .assertIn (msg , str (raises .exception ))
24902489
24912490 with self .assertRaises (ValueError ) as raises :
24922491 hpat_func (series , '' , 1 )
2493- msg = msg_tmpl .format ('find' , 'start' , ' expected: 0' )
2492+ msg = msg_tmpl .format ('expected: 0' )
24942493 self .assertIn (msg , str (raises .exception ))
24952494
24962495 def test_series_str_find_exception_unsupported_end (self ):
@@ -2499,17 +2498,16 @@ def test_impl(series, sub, start, end):
24992498 hpat_func = self .jit (test_impl )
25002499
25012500 series = pd .Series (test_global_input_data_unicode_kind4 )
2502- msg_tmpl = 'Method {} (). The object {} \n {}'
2501+ msg_tmpl = 'Method find (). The object end \n {}'
25032502
25042503 with self .assertRaises (TypingError ) as raises :
25052504 hpat_func (series , '' , 0 , 'None' )
2506- msg = msg_tmpl .format ('find' , 'end' , 'given: unicode_type\n '
2507- 'expected: None, int' )
2505+ msg = msg_tmpl .format ('given: unicode_type\n expected: None, int' )
25082506 self .assertIn (msg , str (raises .exception ))
25092507
25102508 with self .assertRaises (ValueError ) as raises :
25112509 hpat_func (series , '' , 0 , 0 )
2512- msg = msg_tmpl .format ('find' , 'end' , ' expected: None' )
2510+ msg = msg_tmpl .format ('expected: None' )
25132511 self .assertIn (msg , str (raises .exception ))
25142512
25152513 def test_series_str_len1 (self ):
@@ -2524,6 +2522,41 @@ def test_impl(S):
25242522 S = pd .Series (data , index , name = name )
25252523 pd .testing .assert_series_equal (hpat_func (S ), test_impl (S ))
25262524
2525+ def test_series_str_startswith (self ):
2526+ def test_impl (series , pat ):
2527+ return series .str .startswith (pat )
2528+
2529+ hpat_func = self .jit (test_impl )
2530+
2531+ data = test_global_input_data_unicode_kind4
2532+ pats = ['' ] + [s [:min (len (s ) for s in data )] for s in data ] + data
2533+ indices = [None , list (range (len (data )))[::- 1 ], data [::- 1 ]]
2534+ names = [None , 'A' ]
2535+ for index , name in product (indices , names ):
2536+ series = pd .Series (data , index , name = name )
2537+ for pat in pats :
2538+ pd .testing .assert_series_equal (hpat_func (series , pat ),
2539+ test_impl (series , pat ))
2540+
2541+ def test_series_str_startswith_exception_unsupported_na (self ):
2542+ def test_impl (series , pat , na ):
2543+ return series .str .startswith (pat , na )
2544+
2545+ hpat_func = self .jit (test_impl )
2546+
2547+ series = pd .Series (test_global_input_data_unicode_kind4 )
2548+ msg_tmpl = 'Method startswith(). The object na\n {}'
2549+
2550+ with self .assertRaises (TypingError ) as raises :
2551+ hpat_func (series , '' , 'None' )
2552+ msg = msg_tmpl .format ('given: unicode_type\n expected: bool' )
2553+ self .assertIn (msg , str (raises .exception ))
2554+
2555+ with self .assertRaises (ValueError ) as raises :
2556+ hpat_func (series , '' , False )
2557+ msg = msg_tmpl .format ('expected: None' )
2558+ self .assertIn (msg , str (raises .exception ))
2559+
25272560 def test_series_str2str (self ):
25282561 common_methods = ['lower' , 'upper' , 'isupper' ]
25292562 sdc_methods = ['capitalize' , 'swapcase' , 'title' ,
0 commit comments