6
6
import threading
7
7
import time
8
8
import unittest
9
+ import warnings
9
10
try :
10
11
import pandas as pd
11
12
import numpy as np
@@ -96,6 +97,7 @@ def test_workflow_locked_by_other_instance(self):
96
97
)
97
98
t .join ()
98
99
100
+
99
101
def test_container_1_input_1_output_dict_input_with_pandas (self ):
100
102
if pd is None :
101
103
self .skipTest ("pandas not available" )
@@ -163,9 +165,10 @@ def test_container_1_input_1_output_DataFrame_input_no_DataFrame_output(self):
163
165
164
166
165
167
def test_container_1_input_1_output_no_input_data_without_pandas (self ):
166
- results = self .templated_test_container_1_input_1_output (
167
- output_as_pandas_dataframes = False ,
168
- )
168
+ with self .assertWarns (UserWarning ):
169
+ results = self .templated_test_container_1_input_1_output (
170
+ output_as_pandas_dataframes = False ,
171
+ )
169
172
self .assertEqual (len (results ), 1 )
170
173
self .assertTrue (isinstance (results [0 ], dict ))
171
174
returned_table_spec = (list (d )[0 ] for d in results [0 ]["table-spec" ])
@@ -176,9 +179,10 @@ def test_container_1_input_1_output_no_input_data_without_pandas(self):
176
179
177
180
178
181
def test_container_1_input_1_output_no_input_data (self ):
179
- results = self .templated_test_container_1_input_1_output (
180
- output_as_pandas_dataframes = None ,
181
- )
182
+ with self .assertWarns (UserWarning ):
183
+ results = self .templated_test_container_1_input_1_output (
184
+ output_as_pandas_dataframes = None ,
185
+ )
182
186
self .assertEqual (len (results ), 1 )
183
187
if pd is not None :
184
188
self .assertTrue (isinstance (results [0 ], pd .DataFrame ))
@@ -189,9 +193,10 @@ def test_container_1_input_1_output_no_input_data(self):
189
193
def test_container_1_input_1_output_no_input_data_with_pandas (self ):
190
194
if pd is None :
191
195
self .skipTest ("pandas not available" )
192
- results = self .templated_test_container_1_input_1_output (
193
- output_as_pandas_dataframes = True ,
194
- )
196
+ with self .assertWarns (UserWarning ):
197
+ results = self .templated_test_container_1_input_1_output (
198
+ output_as_pandas_dataframes = True ,
199
+ )
195
200
self .assertEqual (len (results ), 1 )
196
201
df = results [0 ]
197
202
self .assertTrue (isinstance (df , pd .DataFrame ))
@@ -298,7 +303,6 @@ def test_container_1_input_1_output_mismatched_input_datatypes(self):
298
303
)
299
304
300
305
301
-
302
306
def test_non_existent_workflow_execution (self ):
303
307
with knime .Workflow ("tests/knime-workspace/never_gonna_give_you_up" ) as wf :
304
308
pass # There was no execute call and so no problem.
@@ -309,7 +313,8 @@ def test_non_existent_workflow_execution(self):
309
313
workflow_path = "never_gonna_let_you_down"
310
314
) as wf :
311
315
# Existence of workflow is only checked in execute().
312
- wf .execute (output_as_pandas_dataframes = False )
316
+ with self .assertWarns (UserWarning ):
317
+ wf .execute (output_as_pandas_dataframes = False )
313
318
results = wf .data_table_outputs [:]
314
319
315
320
@@ -318,15 +323,17 @@ def test_specify_workspace_plus_workflow(self):
318
323
workspace_path = "tests/knime-workspace" ,
319
324
workflow_path = "test_simple_container_table_01"
320
325
) as wf :
321
- wf .execute (output_as_pandas_dataframes = False )
326
+ with self .assertWarns (UserWarning ):
327
+ wf .execute (output_as_pandas_dataframes = False )
322
328
results = wf .data_table_outputs [:]
323
329
self .assertEqual (len (results ), 1 )
324
330
325
331
with knime .Workflow (
326
332
workspace_path = "tests/knime-workspace" ,
327
333
workflow_path = "/test_simple_container_table_01"
328
334
) as wf :
329
- wf .execute (output_as_pandas_dataframes = False )
335
+ with self .assertWarns (UserWarning ):
336
+ wf .execute (output_as_pandas_dataframes = False )
330
337
results = wf .data_table_outputs [:]
331
338
self .assertEqual (len (results ), 1 )
332
339
@@ -336,7 +343,8 @@ def test_specify_workspace_plus_workflow(self):
336
343
workspace_path = "tests/knime-workspace" ,
337
344
workflow_path = "never_gonna_run_around_and_desert_you"
338
345
) as wf :
339
- wf .execute (output_as_pandas_dataframes = False )
346
+ with self .assertWarns (UserWarning ):
347
+ wf .execute (output_as_pandas_dataframes = False )
340
348
results = wf .data_table_outputs [:]
341
349
342
350
with self .assertRaises (FileNotFoundError ):
@@ -345,13 +353,15 @@ def test_specify_workspace_plus_workflow(self):
345
353
workspace_path = "/tests/knime-workspace" ,
346
354
workflow_path = "/test_simple_container_table_01"
347
355
) as wf :
348
- wf .execute (output_as_pandas_dataframes = False )
356
+ with self .assertWarns (UserWarning ):
357
+ wf .execute (output_as_pandas_dataframes = False )
349
358
results = wf .data_table_outputs [:]
350
359
351
360
352
361
def test_AAAA_nosave_workflow_after_execution_as_default (self ):
353
362
with knime .Workflow ("tests/knime-workspace/test_simple_container_table_01" ) as wf :
354
- wf .execute (output_as_pandas_dataframes = False )
363
+ with self .assertWarns (UserWarning ):
364
+ wf .execute (output_as_pandas_dataframes = False )
355
365
results = wf .data_table_outputs [:]
356
366
self .assertEqual (wf .data_table_inputs_parameter_names , ("input" ,))
357
367
@@ -363,7 +373,8 @@ def test_AAAA_nosave_workflow_after_execution_as_default(self):
363
373
def test_zzzz_save_workflow_after_execution (self ):
364
374
with knime .Workflow ("tests/knime-workspace/test_simple_container_table_01" ) as wf :
365
375
wf .save_after_execution = True
366
- wf .execute (output_as_pandas_dataframes = False )
376
+ with self .assertWarns (UserWarning ):
377
+ wf .execute (output_as_pandas_dataframes = False )
367
378
results = wf .data_table_outputs [:]
368
379
self .assertEqual (wf .data_table_inputs_parameter_names , ("input" ,))
369
380
0 commit comments