Skip to content

Commit

Permalink
Add tests for crystal space composition generation
Browse files Browse the repository at this point in the history
  • Loading branch information
AntObi committed Nov 21, 2024
1 parent 534544b commit a998ced
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions smact/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,23 @@ def test_convert_formula(self):
@unittest.skipUnless(
(os.environ.get("MP_API_KEY") or SETTINGS.get("PMG_MAPI_KEY")), "requires MP_API key to be set."
)
def test_generate_composition_with_smact(self):
save_dir = "data/binary/df_binary_label.pkl"
smact_df = generate_composition_with_smact.generate_composition_with_smact(
num_elements=2,
max_stoich=1,
max_atomic_num=10,
save_path=save_dir,
)
self.assertIsInstance(smact_df, pd.DataFrame)
self.assertTrue(len(smact_df) > 0)

# Check if the data was saved to disk
self.assertTrue(os.path.exists(save_dir))

# Clean up
shutil.rmtree("data")

def test_download_compounds_with_mp_api(self):
save_mp_dir = "data/binary/mp_data"
download_compounds_with_mp_api.download_mp_data(
Expand Down

0 comments on commit a998ced

Please sign in to comment.