Skip to content

Refactor test_on_xtype() using @pytest.mark.parametrize and conftest.py #229

Closed
@bobleesj

Description

@bobleesj

Problem

We have 2 PRs opened at the moment, working on the same file.

Once #228 is addressed and merged, refactor:

def test_on_xtype():
    do = DiffractionObject(wavelength=2 * np.pi, xarray=np.array([30, 60]), yarray=np.array([1, 2]), xtype="tth")
    assert np.allclose(do.on_xtype("tth"), [np.array([30, 60]), np.array([1, 2])])
    assert np.allclose(do.on_xtype("2theta"), [np.array([30, 60]), np.array([1, 2])])
    assert np.allclose(do.on_xtype("q"), [np.array([0.51764, 1]), np.array([1, 2])])
    assert np.allclose(do.on_xtype("d"), [np.array([12.13818, 6.28319]), np.array([1, 2])])

Ref: Continuing our in-line comment interactions from #225 (comment)

Proposed solutions

  • Use well defined reusable DO instances defined under contest.py

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions