Skip to content

Commit

Permalink
protect YODA1 writer against under/overflows
Browse files Browse the repository at this point in the history
  • Loading branch information
20DM committed Mar 7, 2024
1 parent 8071515 commit cd72583
Show file tree
Hide file tree
Showing 3 changed files with 2,820 additions and 1 deletion.
14 changes: 14 additions & 0 deletions hepdata_converter/testsuite/test_yoda1writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,17 @@ def test_parse_all(self, test_submissions):
options={'output_format': 'yoda1'})

self.assertNotEqual(os.stat(output_file_path).st_size, 0, 'output yoda file is empty')


@insert_path('yaml_inf')
@insert_data_as_file('yoda1/with_overflows.yoda')
def test_parse_no_dependent(self, yaml_simple_path, yoda_template):
output_file_path = os.path.join(self.current_tmp, 'datafile.yoda')
hepdata_converter.convert(yaml_simple_path, output_file_path,
options={'output_format': 'yoda1',
'validator_schema_version': '0.1.0',
'rivet_analysis_name': 'OVERFLOW_TEST'})

self.assertNotEqual(os.stat(output_file_path).st_size, 0, 'output yoda file is empty')
with open(output_file_path, 'r') as f:
self.assertMultiLineAlmostEqual(f, yoda_template)
Loading

0 comments on commit cd72583

Please sign in to comment.