@@ -741,7 +741,7 @@ def test_impl(df):
741741 np .testing .assert_array_equal (sdc_func (df ), test_impl (df ))
742742
743743 @skip_sdc_jit
744- @dfRefactoringNotImplemented
744+ @dfRefactoringNotImplemented # required re-implementing DataFrame unboxing
745745 def test_index_attribute (self ):
746746 index_to_test = [[1 , 2 , 3 , 4 , 5 ],
747747 [.1 , .2 , .3 , .4 , .5 ],
@@ -757,7 +757,7 @@ def test_index_attribute(self):
757757 self ._test_df_index (df )
758758
759759 @skip_sdc_jit
760- @dfRefactoringNotImplemented
760+ @dfRefactoringNotImplemented # required re-implementing DataFrame unboxing
761761 def test_index_attribute_empty (self ):
762762 n = 5
763763 np .random .seed (0 )
@@ -768,11 +768,45 @@ def test_index_attribute_empty(self):
768768 self ._test_df_index (df )
769769
770770 @skip_sdc_jit
771- @dfRefactoringNotImplemented
771+ @dfRefactoringNotImplemented # required re-implementing DataFrame unboxing
772772 def test_index_attribute_empty_df (self ):
773773 df = pd .DataFrame ()
774774 self ._test_df_index (df )
775775
776+ def test_index_attribute_no_unboxing (self ):
777+ def test_impl (n , index ):
778+ np .random .seed (0 )
779+ df = pd .DataFrame ({
780+ 'A' : np .ones (n ),
781+ 'B' : np .random .ranf (n )
782+ }, index = index )
783+ return df .index
784+
785+ sdc_impl = self .jit (test_impl )
786+ index_to_test = [
787+ [1 , 2 , 3 , 4 , 5 ],
788+ [.1 , .2 , .3 , .4 , .5 ],
789+ ['a' , 'b' , 'c' , 'd' , 'e' ]
790+ ]
791+ for index in index_to_test :
792+ with self .subTest (index = index ):
793+ n = len (index )
794+ jit_result = sdc_impl (n , index )
795+ ref_result = test_impl (n , index )
796+ np .testing .assert_array_equal (jit_result , ref_result )
797+
798+ def test_index_attribute_default_no_unboxing (self ):
799+ def test_impl (n ):
800+ np .random .seed (0 )
801+ df = pd .DataFrame ({
802+ 'A' : np .ones (n ),
803+ 'B' : np .random .ranf (n )
804+ })
805+ return df .index
806+
807+ sdc_impl = self .jit (test_impl )
808+ np .testing .assert_array_equal (sdc_impl (10 ), test_impl (10 ))
809+
776810 @skip_sdc_jit
777811 @skip_numba_jit
778812 def test_df_apply (self ):
0 commit comments