Exemple #1
0
    def test_sample_all_not_fitted(self):
        """Check that the sample_all raise an exception when is not fitted."""
        # Run & asserts
        sdv = Mock()
        sdv.sampler = None

        with pytest.raises(NotFittedError):
            SDV.sample_all(sdv)
Exemple #2
0
    def test_sample_all_fitted(self):
        """Check that the sample_all is called"""
        # Run
        sdv = Mock()
        sdv.sampler.sample_all.return_value = 'test'

        result = SDV.sample_all(sdv)

        # Asserts
        sdv.sampler.sample_all.assert_called_once_with(
            5, reset_primary_keys=False)
        assert result == 'test'
Exemple #3
0
Fichier : demo.py Projet : Aylr/SDV
def run_demo(folder_name):
    """Runs the demo for specified folder"""
    start = timer()
    meta_file = os.path.join('demo', folder_name,
                             folder_name.capitalize() + '_manual_meta.json')
    sdv = SDV(meta_file)
    sdv.fit()
    sampled = sdv.sample_all()

    LOGGER.info('Parent map: %s', sdv.dn.parent_map)
    LOGGER.info('Transformed data: %s', sdv.dn.transformed_data)

    for name, table in sampled.items():
        LOGGER.info('Sampled row from %s: %s', name, table.head(3).T)

    end = timer()
    LOGGER.info('Total time: %s seconds', round(end - start))