MCPcopy Create free account
hub / github.com/NSLS2/PyXRF / test_ParamQuantEstimation_1

Function test_ParamQuantEstimation_1

pyxrf/core/tests/test_quant_analysis.py:541–567  ·  view source on GitHub ↗

r""" Create the object of the 'ParamQuantEstimation' class. Load and then clear reference data.

(tmp_path)

Source from the content-addressed store, hash-verified

539
540
541def test_ParamQuantEstimation_1(tmp_path):
542 r"""
543 Create the object of the 'ParamQuantEstimation' class. Load and then clear reference data.
544 """
545
546 # 'home_dir' is typically '~', but for testing it is set to 'tmp_dir'
547 home_dir = tmp_path
548 config_dir = ".pyxrf"
549 standards_fln = "quantitative_standards.yaml"
550
551 pqe = ParamQuantEstimation(home_dir=home_dir)
552
553 # Verify that the cofig file was created
554 file_path = os.path.join(home_dir, config_dir, standards_fln)
555 assert os.path.isfile(
556 file_path
557 ), f"Empty file for user-defined reference standards '{file_path}' was not created"
558
559 # Load reference standards
560 pqe.load_standards()
561 assert pqe.standards_built_in is not None, "Failed to load built-in standards"
562 assert pqe.standards_custom is not None, "Failed to load user-defined standards"
563
564 # Clear loaded standards
565 pqe.clear_standards()
566 assert pqe.standards_built_in is None, "Failed to clear loaded built-in standards"
567 assert pqe.standards_custom is None, "Failed to clear loaded user-defined standards"
568
569
570def test_ParamQuantEstimation_2(tmp_path):

Callers

nothing calls this directly

Calls 3

load_standardsMethod · 0.95
clear_standardsMethod · 0.95

Tested by

no test coverage detected