3131import decimal
3232
3333import oracledb
34-
35- try :
36- import numpy
37- import pandas
38- import pyarrow
39-
40- HAS_INTEROP = True
41- except ImportError :
42- HAS_INTEROP = False
43-
34+ import numpy
35+ import pandas
36+ import pyarrow
4437import test_env
4538
4639# basic
253246
254247class TestCase (test_env .BaseTestCase ):
255248
256- def __check_interop (self ):
257- """
258- Checks to see if the pyarrow and pandas modules are available.
259- """
260- if not HAS_INTEROP :
261- self .skipTest ("missing numpy, pandas or pyarrow modules" )
262-
263249 def __convert_date (self , value ):
264250 """
265251 Converts a date to the format required by Arrow.
@@ -379,7 +365,6 @@ def __test_df_interop(self, data):
379365 Tests interoperability with external data frames using the data set
380366 provided.
381367 """
382- self .__check_interop ()
383368 self .__populate_table (data )
384369 ora_df = self .conn .fetch_df_all (QUERY_SQL )
385370 self .__validate_df (ora_df , data )
@@ -389,7 +374,6 @@ def __test_df_batches_interop(self, data, batch_size, num_batches):
389374 Tests interoperability with external data frames using the data set
390375 provided.
391376 """
392- self .__check_interop ()
393377 self .__populate_table (data )
394378 batches = list (self .conn .fetch_df_batches (QUERY_SQL , size = batch_size ))
395379 self .assertEqual (len (batches ), num_batches )
@@ -462,7 +446,6 @@ def test_8009(self):
462446
463447 def test_8010 (self ):
464448 "8010 - verify passing Arrow arrays twice works"
465- self .__check_interop ()
466449 self .__populate_table (DATASET_1 )
467450 ora_df = self .conn .fetch_df_all (QUERY_SQL )
468451 self .__validate_df (ora_df , DATASET_1 )
@@ -507,7 +490,6 @@ def test_8015(self):
507490
508491 def test_8016 (self ):
509492 "8016 - verify get_column() returns the correct value"
510- self .__check_interop ()
511493 self .__populate_table (DATASET_1 )
512494 ora_df = self .conn .fetch_df_all (QUERY_SQL )
513495 array = pyarrow .array (ora_df .get_column (1 ))
@@ -520,7 +502,6 @@ def test_8017(self):
520502 def test_8018 (self ):
521503 "8018 - fetch_decimals without precision and scale specified"
522504 data = [(1.0 ,)]
523- self .__check_interop ()
524505 with test_env .DefaultsContextManager ("fetch_decimals" , True ):
525506 ora_df = self .conn .fetch_df_all ("select 1.0 from dual" )
526507 fetched_tab = pyarrow .Table .from_arrays (
@@ -533,7 +514,6 @@ def test_8018(self):
533514 def test_8019 (self ):
534515 "8019 - fetch clob"
535516 data = [("test_8023" ,)]
536- self .__check_interop ()
537517 ora_df = self .conn .fetch_df_all (
538518 "select to_clob('test_8023') from dual"
539519 )
@@ -544,7 +524,6 @@ def test_8019(self):
544524 def test_8020 (self ):
545525 "8020 - fetch blob"
546526 data = [(b"test_8024" ,)]
547- self .__check_interop ()
548527 ora_df = self .conn .fetch_df_all (
549528 "select to_blob(utl_raw.cast_to_raw('test_8024')) from dual"
550529 )
@@ -555,7 +534,6 @@ def test_8020(self):
555534 def test_8021 (self ):
556535 "8021 - fetch raw"
557536 data = [(b"test_8025" ,)]
558- self .__check_interop ()
559537 ora_df = self .conn .fetch_df_all (
560538 "select utl_raw.cast_to_raw('test_8025') from dual"
561539 )
@@ -567,7 +545,6 @@ def test_8021(self):
567545 def test_8022 (self ):
568546 "8022 - fetch boolean"
569547 data = [(True ,), (False ,), (False ,), (True ,), (True ,)]
570- self .__check_interop ()
571548 ora_df = self .conn .fetch_df_all (
572549 """
573550 select true
@@ -587,7 +564,6 @@ def test_8022(self):
587564
588565 def test_8023 (self ):
589566 "8023 - fetch data with multiple rows containing null values"
590- self .__check_interop ()
591567 ora_df = self .conn .fetch_df_all (
592568 """
593569 select to_date('2025-06-12', 'YYYY-MM-DD') as data from dual
@@ -638,7 +614,6 @@ def test_8024(self):
638614 (array .array ("f" , [34.6 , 77.8 ]).tolist (),),
639615 (array .array ("f" , [34.6 , 77.8 , 55.9 ]).tolist (),),
640616 ]
641- self .__check_interop ()
642617 ora_df = self .conn .fetch_df_all (
643618 """
644619 SELECT TO_VECTOR('[34.6, 77.8]', 2, FLOAT32)
@@ -658,7 +633,6 @@ def test_8025(self):
658633 ([34.6 , 77.8 ],),
659634 ([34.6 , 77.8 , 55.9 ],),
660635 ]
661- self .__check_interop ()
662636 ora_df = self .conn .fetch_df_all (
663637 """
664638 SELECT TO_VECTOR('[34.6, 77.8]', 2, FLOAT64)
@@ -678,7 +652,6 @@ def test_8026(self):
678652 ([34 , - 77 ],),
679653 ([34 , 77 , 55 ],),
680654 ]
681- self .__check_interop ()
682655 ora_df = self .conn .fetch_df_all (
683656 """
684657 SELECT TO_VECTOR('[34, -77]', 2, INT8)
@@ -698,7 +671,6 @@ def test_8027(self):
698671 ([3 , 2 , 3 ],),
699672 ([3 , 2 ],),
700673 ]
701- self .__check_interop ()
702674 ora_df = self .conn .fetch_df_all (
703675 """
704676 SELECT TO_VECTOR('[3, 2, 3]', 24, BINARY)
@@ -719,7 +691,6 @@ def test_8028(self):
719691 (array .array ("f" , [34.6 , 77.8 , 55.9 ]).tolist (),),
720692 (None ,),
721693 ]
722- self .__check_interop ()
723694 ora_df = self .conn .fetch_df_all (
724695 """
725696 SELECT TO_VECTOR('[34.6, 77.8]', 2, FLOAT32)
@@ -751,7 +722,6 @@ def test_8029(self):
751722 ([34.6 , 77.8 ],),
752723 ([34.6 , 77.8 ],),
753724 ]
754- self .__check_interop ()
755725 ora_df = self .conn .fetch_df_all (
756726 """
757727 SELECT TO_VECTOR('[34.6, 77.8]', 2, FLOAT64)
@@ -803,7 +773,6 @@ def test_8030(self):
803773 },
804774 ),
805775 ]
806- self .__check_interop ()
807776 ora_df = self .conn .fetch_df_all (
808777 """
809778 SELECT TO_VECTOR(
@@ -845,7 +814,6 @@ def test_8031(self):
845814 },
846815 ),
847816 ]
848- self .__check_interop ()
849817 ora_df = self .conn .fetch_df_all (
850818 """
851819 SELECT TO_VECTOR(
@@ -883,7 +851,6 @@ def test_8032(self):
883851 @test_env .skip_unless_sparse_vectors_supported ()
884852 def test_8033 (self ):
885853 "8033 - DPY-4007 -fetch sparse vectors with flexible dimensions"
886- self .__check_interop ()
887854 with self .assertRaisesFullCode ("DPY-2065" ):
888855 self .conn .fetch_df_all (
889856 """
@@ -914,7 +881,6 @@ def test_8034(self):
914881 (56.25 ,),
915882 (91.25 ,),
916883 ]
917- self .__check_interop ()
918884 self .__populate_table (dataset )
919885
920886 # Use numeric expression involving a column
0 commit comments