Skip to content

Commit

Permalink
tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vittoria Tommasini committed Dec 17, 2024
1 parent 8c2ceba commit f2ba8eb
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
34 changes: 30 additions & 4 deletions tests/support/Pipelines/Bbh/Test_EccentricityControl.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,24 +62,50 @@ def create_h5_file(self):

def create_yaml_file(self):
# Define YAML data and write it to the file
metadata = {
"Next": {
"With": {
"control_params": {
"mass_A": 1.0,
"mass_B": 1.0,
"spin_A": [0.0, 0.0, 0.0],
"spin_B": [0.0, 0.0, 0.0],
},
"refinement_level": 1,
"polynomial_order": 10,
}
}
}

data1 = {
"Background": {
"Binary": {"AngularVelocity": 0.01, "Expansion": 0.001}
"Binary": {
"AngularVelocity": 0.01,
"Expansion": 0.001,
"XCoords": [10.0, -10.0], # Example values for XCoords
}
}
}

# Pass both metadata and data1 to the YAML file
with open(self.id_input_file_path, "w") as yaml_file:
# Keep first dictionary in this list empty to match
# the structure of the real file
yaml.dump_all([{}, data1], yaml_file)
yaml.dump_all([metadata, data1], yaml_file)

# Test the eccentricity control function with the created files
def test_eccentricity_control(self):
output_path = os.path.join(self.test_dir, "output.pdf")
# Call the function with updated parameters
eccentricity_control(
h5_file=self.h5_filename,
id_input_file_path=self.id_input_file_path,
pipeline_dir=self.test_dir,
tmin=0,
tmax=10,
output=output_path,
)
# Add checks if necessary
self.assertTrue(
os.path.exists(os.path.join(self.test_dir, "output.pdf"))
)


Expand Down
1 change: 1 addition & 0 deletions tests/support/Python/Test_DirectoryStructure.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
from spectre.Informer import unit_test_build_path
from spectre.support.DirectoryStructure import (
Checkpoint,
PipelineStep,
Segment,
list_checkpoints,
list_pipeline_steps,
Expand Down

0 comments on commit f2ba8eb

Please sign in to comment.