Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
lajohn4747 committed May 20, 2024
1 parent 416557c commit a053814
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/integration/sequential/test_par.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,3 +249,36 @@ def test_par_subset_of_data_simplified():

# Assert
assert not pd.isna(synthetic_data['date']).any()


def test_par_missing_sequence_index():
"""Test if PAR Synthesizer can run without a sequence key"""
# Setup
metadata_dict = {
'columns': {
'value': {
'sdtype': 'numerical'
},
'e_id': {
'sdtype': 'id'
}
},
'METADATA_SPEC_VERSION': 'SINGLE_TABLE_V1',
'sequence_key': 'e_id'
}

metadata = SingleTableMetadata().load_from_dict(metadata_dict)

data = pd.DataFrame({
'value': [10, 20, 30],
'e_id': [1, 2, 3]
})

# Run
synthesizer = PARSynthesizer(metadata)
synthesizer.fit(data)
sampled = synthesizer.sample(num_sequences=3)

# Assert
assert sampled.shape == data.shape
assert (sampled.dtypes == data.dtypes).all()

0 comments on commit a053814

Please sign in to comment.