def test_sample_not_fitted(self): """Check that the sample raise an exception when is not fitted.""" # Setup sdv = SDV() # Run with pytest.raises(NotFittedError): sdv.sample('DEMO', 5)
def test_sample_not_fitted(self): """Check that the sample raise an exception when is not fitted.""" # Setup sdv = Mock() sdv.sampler = None # Run with pytest.raises(NotFittedError): SDV.sample(sdv, 'DEMO', 5)
def test_sample_not_fitted(self): """Check that the sample raise an exception when is not fitted.""" # Run and asserts sdv = Mock() sdv.sampler = None table_name = 'DEMO' num_rows = 5 with pytest.raises(NotFittedError): SDV.sample(sdv, table_name, num_rows)
def test_sample_fitted(self): """Check that the sample is called.""" # Sample sdv = Mock() sdv._model_instance.sample.return_value = 'test' # Run result = SDV.sample(sdv, 'DEMO', 5) # Asserts assert result == 'test' sdv._model_instance.sample.assert_called_once_with( 'DEMO', 5, sample_children=True, reset_primary_keys=False)
def test_sample_fitted(self): """Check that the sample is called.""" # Run sdv = Mock() table_name = 'DEMO' num_rows = 5 sdv.sampler.sample.return_value = 'test' result = SDV.sample(sdv, table_name, num_rows) # Asserts sdv.sampler.sample.assert_called_once_with('DEMO', 5, sample_children=True, reset_primary_keys=False) assert result == 'test'