@@ -505,7 +505,6 @@ def test__preprocess_helper_basesynthesizer(self, mock_warnings):
505
505
instance = Mock ()
506
506
instance ._fitted = True
507
507
data = pd .DataFrame ({'name' : ['John' , 'Doe' , 'John Doe' ]})
508
- instance ._store_and_convert_original_cols .return_value = False
509
508
510
509
# Run
511
510
result = BaseSynthesizer ._preprocess_helper (instance , data )
@@ -517,8 +516,7 @@ def test__preprocess_helper_basesynthesizer(self, mock_warnings):
517
516
)
518
517
mock_warnings .warn .assert_called_once_with (expected_warning )
519
518
instance .validate .assert_called_once_with (data )
520
- pd .testing .assert_frame_equal (result [0 ], data )
521
- assert result [1 ] is False
519
+ pd .testing .assert_frame_equal (result , data )
522
520
523
521
@patch .object (BaseSynthesizer , '_preprocess_helper' )
524
522
def test__preprocess_helper (self , mock_preprocess_helper ):
@@ -536,14 +534,13 @@ def test__preprocess_helper(self, mock_preprocess_helper):
536
534
instance = BaseSingleTableSynthesizer (metadata )
537
535
data = pd .DataFrame ({'name' : ['John' , 'Doe' , 'John Doe' ]})
538
536
instance ._transform_helper = Mock (return_value = data )
539
- mock_preprocess_helper .return_value = ( data , False )
537
+ mock_preprocess_helper .return_value = data
540
538
541
539
# Run
542
540
result = instance ._preprocess_helper (data )
543
541
544
542
# Assert
545
- pd .testing .assert_frame_equal (result [0 ], data )
546
- assert result [1 ] is False
543
+ pd .testing .assert_frame_equal (result , data )
547
544
instance ._transform_helper .assert_called_once_with (data )
548
545
549
546
def test__preprocess (self ):
@@ -569,22 +566,20 @@ def test__preprocess(self):
569
566
)
570
567
571
568
def test_preprocess (self ):
572
- """Test the preprocess method.
573
-
574
- The preprocess method raises a warning if it was already fitted and then calls
575
- ``_preprocess``.
576
- """
569
+ """Test the preprocess method."""
577
570
# Setup
578
571
instance = Mock ()
579
572
instance ._fitted = True
580
573
data = pd .DataFrame ({'name' : ['John' , 'Doe' , 'John Doe' ]})
581
- instance ._preprocess_helper .return_value = (data , False )
574
+ instance ._preprocess_helper .return_value = data
575
+ instance ._store_and_convert_original_cols = Mock (return_value = False )
582
576
instance ._preprocess .return_value = data
583
577
584
578
# Run
585
579
result = BaseSingleTableSynthesizer .preprocess (instance , data )
586
580
587
581
# Assert
582
+ instance ._store_and_convert_original_cols .assert_called_once_with (data )
588
583
instance ._preprocess_helper .assert_called_once_with (data )
589
584
instance ._preprocess .assert_called_once_with (data )
590
585
pd .testing .assert_frame_equal (result , data )
0 commit comments