Skip to content

Commit

Permalink
added tests for figure fetching without extension
Browse files Browse the repository at this point in the history
  • Loading branch information
ItamarGoldman committed Oct 23, 2023
1 parent c40320b commit 0e32e91
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/database_service/test_db_experiment_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -409,6 +409,8 @@ def test_get_figure(self):
exp_data = ExperimentData(experiment_type="qiskit_test")
figure_template = "hello world {}"
name_template = "figure_{}.svg"
name_template_wo_ext = "figure_{}"

for idx in range(3):
exp_data.add_figures(
str.encode(figure_template.format(idx)), figure_names=name_template.format(idx)
Expand All @@ -418,6 +420,11 @@ def test_get_figure(self):
self.assertEqual(expected_figure, exp_data.figure(name_template.format(idx)).figure)
self.assertEqual(expected_figure, exp_data.figure(idx).figure)

# Check that figure will be returned without file extension in name
expected_figure = str.encode(figure_template.format(idx))
self.assertEqual(expected_figure, exp_data.figure(name_template_wo_ext.format(idx)).figure)
self.assertEqual(expected_figure, exp_data.figure(idx).figure)

file_name = uuid.uuid4().hex
self.addCleanup(os.remove, file_name)
exp_data.figure(idx, file_name)
Expand Down

0 comments on commit 0e32e91

Please sign in to comment.