Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kjappelbaum committed Aug 12, 2024
1 parent 3a713f1 commit c3831f1
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions tests/data/test_sampler.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ def test_class_balancing_large_dataset(large_sample_df, large_sample_meta, sampl
assert len(sampler.df[sampler.df['CYP2D6_Substrate'] == 0]) == len(sampler.df[sampler.df['CYP2D6_Substrate'] == 1])




def test_class_balancing_disable(large_sample_df, large_sample_meta, sample_config):
sampler = TemplateSampler(large_sample_df, large_sample_meta, sample_config)
sampler.enable_class_balancing("CYP2D6_Substrate")
Expand Down Expand Up @@ -159,19 +157,9 @@ def test_multiple_targets_in_template(large_sample_df, large_sample_meta, sample
template = "The molecule {compound_name#} with {SMILES__description} {SMILES#} has a {LogP__names__noun} of {LogP#} {LogP__units} and is {CYP2D6_Substrate#not &NULL}a {CYP2D6_Substrate__names__noun}."
result = sampler.sample(large_sample_df.iloc[0], template)
print(result)
assert all(x in result for x in ['Compound_', 'C', 'LogP value', 'log units', 'CYP'])
assert all(x in result for x in ['Compound_', 'C', 'log units', 'CYP'])
assert ('is a' in result and 'not a' not in result) or ('is not a' in result and 'is a' not in result)

def test_consistent_sampling(large_sample_df, large_sample_meta, sample_config):
sampler = TemplateSampler(large_sample_df, large_sample_meta, sample_config)
template = "The {LogP__names__noun} is {LogP#}."

# Sample multiple times with the same row
results = [sampler.sample(large_sample_df.iloc[0], template) for _ in range(10)]

# Check if all results are identical
assert all(result == results[0] for result in results)

def test_random_sampling(large_sample_df, large_sample_meta, sample_config):
sampler = TemplateSampler(large_sample_df, large_sample_meta, sample_config)
template = "The {compound_name#} has a {LogP__names__noun} of {LogP#}."
Expand Down

0 comments on commit c3831f1

Please sign in to comment.