Skip to content

Commit

Permalink
Add unit tests for preprocess arg parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristosT committed Jan 9, 2025
1 parent a0b9f0b commit 993943a
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions tests/test_preprocess.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
from hexrd.preprocess.profiles import (
Eiger_Arguments,
Dexelas_Arguments,
HexrdScript_Arguments,
)


# test load/safe with defaults
def test_save_load_defaults_eiger():
eargs = Eiger_Arguments()
buffer = eargs.dump_config()
args = HexrdScript_Arguments.load_from_config(buffer)
assert eargs == args


def test_save_load_defaults_dexelas():
eargs = Dexelas_Arguments()
buffer = eargs.dump_config()
args = HexrdScript_Arguments.load_from_config(buffer)
assert eargs == args


# test load/safe with modified parameters
def test_save_load_eiger():
eargs = Eiger_Arguments()
eargs.base_dir = "/data"
eargs.num_frames = 1
buffer = eargs.dump_config()
args = HexrdScript_Arguments.load_from_config(buffer)
assert eargs == args


def test_save_load_dexelas():
eargs = Dexelas_Arguments()
eargs.base_dir = "/data"
eargs.num_frames = 1
eargs.panel_opts["FF1"] = {("add-row", 1000)}
buffer = eargs.dump_config()
args = HexrdScript_Arguments.load_from_config(buffer)
assert eargs == args

0 comments on commit 993943a

Please sign in to comment.