-
Notifications
You must be signed in to change notification settings - Fork 302
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for
load_demo
method (#399)
- Loading branch information
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
from ctgan import CTGAN, load_demo | ||
|
||
|
||
def test_load_demo(): | ||
"""End-to-end test to load and synthesize data.""" | ||
# Setup | ||
discrete_columns = [ | ||
'workclass', | ||
'education', | ||
'marital-status', | ||
'occupation', | ||
'relationship', | ||
'race', | ||
'sex', | ||
'native-country', | ||
'income', | ||
] | ||
ctgan = CTGAN(epochs=1) | ||
|
||
# Run | ||
data = load_demo() | ||
ctgan.fit(data, discrete_columns) | ||
samples = ctgan.sample(1000, condition_column='native-country', condition_value='United-States') | ||
|
||
# Assert | ||
assert samples.shape == (1000, 15) | ||
assert all([col[0] != ' ' for col in samples.columns]) | ||
assert not samples.isna().any().any() |