Skip to content

Commit

Permalink
add test
Browse files Browse the repository at this point in the history
  • Loading branch information
frances-h committed Nov 17, 2023
1 parent 3bd495b commit 636fd19
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions tests/unit/multi_table/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,8 @@ def test_get_table_parameters_has_parameters(self):
'numerical_distributions': {}
}

def test_get_parameters(self):
"""Test that the table's synthesizer parameters are being returned."""
def test_get_parameters_missing_table(self):
"""Test that the synthesizer's parameters are being returned."""
# Setup
metadata = get_multi_table_metadata()
instance = BaseMultiTableSynthesizer(metadata, locales='en_CA')
Expand Down Expand Up @@ -283,6 +283,48 @@ def test_get_parameters(self):
}
}

def test_get_parameters_empty(self):
"""Test that ``get_parameters`` handles missing table synthesizers."""
# Setup
metadata = get_multi_table_metadata()
instance = BaseMultiTableSynthesizer(metadata, locales='en_CA')
instance._table_synthesizers['nesreca'] = None

# Run
result = instance.get_parameters()

# Assert
assert result == {
'locales': 'en_CA',
'verbose': False,
'tables': {
'nesreca': {
'table_synthesizer': None,
'table_parameters': {}
},
'oseba': {
'table_synthesizer': 'GaussianCopulaSynthesizer',
'table_parameters': {
'enforce_min_max_values': True,
'enforce_rounding': True,
'locales': 'en_CA',
'numerical_distributions': {},
'default_distribution': 'beta'
}
},
'upravna_enota': {
'table_synthesizer': 'GaussianCopulaSynthesizer',
'table_parameters': {
'enforce_min_max_values': True,
'enforce_rounding': True,
'locales': 'en_CA',
'numerical_distributions': {},
'default_distribution': 'beta'
}
}
}
}

def test_set_table_parameters(self):
"""Test that the table's parameters are being updated.
Expand Down

0 comments on commit 636fd19

Please sign in to comment.