Skip to content

Commit

Permalink
add tests for latex string
Browse files Browse the repository at this point in the history
  • Loading branch information
trappitsch committed Apr 5, 2024
1 parent 12118dd commit 19c446f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/rimsschemedrawer/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,9 +873,9 @@ def write_json(self) -> dict:
dispforbidden = "noshow"
savedict["settings"]["show_forbidden_transitions"] = dispforbidden
savedict["settings"]["plot_title"] = self.edt_sett_plttitle.text()
savedict["settings"][
"show_transition_strength"
] = self.chk_sett_trans_strength.isChecked()
savedict["settings"]["show_transition_strength"] = (
self.chk_sett_trans_strength.isChecked()
)
savedict["settings"]["line_breaks"] = self.chk_sett_linebreaks.isChecked()
savedict["settings"]["show_cm-1_axis"] = self.chk_sett_showcmax.isChecked()
savedict["settings"]["show_eV_axis"] = self.chk_sett_showevax.isChecked()
Expand Down
7 changes: 7 additions & 0 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ def test_term_to_string(vals):
assert ut.term_to_string(vals[0]) == vals[1]


def test_term_to_string_latex():
"""Return a string surrounded by $ if LaTeX characters found."""
str_in = "^{3}F_{2}"
str_exp = f"${str_in}$"
assert ut.term_to_string(str_in) == str_exp


@pytest.mark.parametrize("val", ["IP", "AI", "Rydberg", "Ryd"])
def test_term_to_string_no_change(val):
"""Leave these symbols / strings unchanged."""
Expand Down

0 comments on commit 19c446f

Please sign in to comment.