@@ -334,10 +334,27 @@ def test_valid_dataframe(self):
334334 }
335335 )
336336
337- # This should not raise an exception
338- self .store .write_to_online_store (
339- feature_view_name = "driver_hourly_stats" , df = valid_df
340- )
337+ # This should not raise an exception or warnings
338+ with warnings .catch_warnings (record = True ) as warning_list :
339+ warnings .simplefilter ("always" )
340+ self .store .write_to_online_store (
341+ feature_view_name = "driver_hourly_stats" , df = valid_df
342+ )
343+
344+ # Validate that our specific empty dataframe warnings are NOT raised for valid data
345+ empty_df_warning_messages = [
346+ "Cannot write empty dataframe to online store" ,
347+ "Cannot write dataframe with empty feature columns to online store"
348+ ]
349+
350+ for warning in warning_list :
351+ warning_message = str (warning .message )
352+ for empty_df_msg in empty_df_warning_messages :
353+ self .assertNotIn (
354+ empty_df_msg ,
355+ warning_message ,
356+ f"Valid dataframe should not generate empty dataframe warnings. Found: '{ warning_message } '"
357+ )
341358
342359 def test_valid_dataframe_async (self ):
343360 """Test that valid dataframe with feature data succeeds in async version"""
@@ -356,10 +373,27 @@ async def test_async_valid():
356373 }
357374 )
358375
359- # This should not raise an exception
360- await self .store .write_to_online_store_async (
361- feature_view_name = "driver_hourly_stats" , df = valid_df
362- )
376+ # This should not raise an exception or warnings
377+ with warnings .catch_warnings (record = True ) as warning_list :
378+ warnings .simplefilter ("always" )
379+ await self .store .write_to_online_store_async (
380+ feature_view_name = "driver_hourly_stats" , df = valid_df
381+ )
382+
383+ # Validate that our specific empty dataframe warnings are NOT raised for valid data
384+ empty_df_warning_messages = [
385+ "Cannot write empty dataframe to online store" ,
386+ "Cannot write dataframe with empty feature columns to online store"
387+ ]
388+
389+ for warning in warning_list :
390+ warning_message = str (warning .message )
391+ for empty_df_msg in empty_df_warning_messages :
392+ self .assertNotIn (
393+ empty_df_msg ,
394+ warning_message ,
395+ f"Valid dataframe should not generate empty dataframe warnings in async. Found: '{ warning_message } '"
396+ )
363397
364398 asyncio .run (test_async_valid ())
365399
@@ -378,9 +412,26 @@ def test_mixed_dataframe_with_some_valid_features(self):
378412 )
379413
380414 # This should not raise an exception because not all feature values are null
381- self .store .write_to_online_store (
382- feature_view_name = "driver_hourly_stats" , df = mixed_df
383- )
415+ with warnings .catch_warnings (record = True ) as warning_list :
416+ warnings .simplefilter ("always" )
417+ self .store .write_to_online_store (
418+ feature_view_name = "driver_hourly_stats" , df = mixed_df
419+ )
420+
421+ # Validate that our specific empty dataframe warnings are NOT raised for mixed valid data
422+ empty_df_warning_messages = [
423+ "Cannot write empty dataframe to online store" ,
424+ "Cannot write dataframe with empty feature columns to online store"
425+ ]
426+
427+ for warning in warning_list :
428+ warning_message = str (warning .message )
429+ for empty_df_msg in empty_df_warning_messages :
430+ self .assertNotIn (
431+ empty_df_msg ,
432+ warning_message ,
433+ f"Mixed dataframe with valid features should not generate empty dataframe warnings. Found: '{ warning_message } '"
434+ )
384435
385436 def test_empty_inputs_dict_warns (self ):
386437 """Test that empty inputs dict warns instead of raising error"""
@@ -536,11 +587,32 @@ def test_multiple_feature_views_materialization_with_empty_data(self):
536587 test_store .apply ([driver , customer ] + feature_views )
537588
538589 # Test: Use materialize() to move data from offline to online store
539- test_store .materialize (
540- start_date = start_date ,
541- end_date = end_date ,
542- feature_views = [fv .name for fv in feature_views ],
543- )
590+ # This should NOT raise any exceptions even with empty data
591+ try :
592+ with warnings .catch_warnings (record = True ) as warning_list :
593+ warnings .simplefilter ("always" )
594+ test_store .materialize (
595+ start_date = start_date ,
596+ end_date = end_date ,
597+ feature_views = [fv .name for fv in feature_views ],
598+ )
599+ except Exception as e :
600+ self .fail (f"Materialization raised an unexpected exception: { e } " )
601+
602+ # Validate that our specific empty dataframe warnings are NOT raised during materialization
603+ empty_df_warning_messages = [
604+ "Cannot write empty dataframe to online store" ,
605+ "Cannot write dataframe with empty feature columns to online store"
606+ ]
607+
608+ for warning in warning_list :
609+ warning_message = str (warning .message )
610+ for empty_df_msg in empty_df_warning_messages :
611+ self .assertNotIn (
612+ empty_df_msg ,
613+ warning_message ,
614+ f"Materialization should not generate empty dataframe warnings. Found: '{ warning_message } '"
615+ )
544616
545617 # Verify that the operation was successful by checking that non-empty feature views have data
546618 successful_materializations = 0
0 commit comments