Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/examples/npintensity.py
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ def makeData(strufile, q, datname, scale, a, Uiso, sig, bkgc, nl=1):
S.read(str(strufile))

# Set the lattice parameters
S.lattice.setLatPar(a, a, a)
S.lattice.set_latt_parms(a, a, a)

# Set a DW factor
for a in S:
Expand Down
23 changes: 23 additions & 0 deletions news/fix-warnings.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* No news added: Silence warnings raised during testing and use set_latt_parms in place of the deprecated setLatPar in the tests and npintensity example.

**Changed:**

* <news item>

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>
5 changes: 4 additions & 1 deletion tests/test_characteristicfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,10 @@ def test_deprecated_functions_forward_non_physical_input(
):
old_function = getattr(cf, old_name)
new_function = getattr(cf, new_name)
expected_characteristic_function = new_function(*new_args)
# Catch the RuntimeWarning to prevent warnings when tests run.
# This test passes non-phyiscal inputs so this behavior is expected here.
with pytest.warns(RuntimeWarning):
expected_characteristic_function = new_function(*new_args)

# The oracle call above already consumed the once-per-process
# RuntimeWarning for this (function, requirement) pair; clear the
Expand Down
2 changes: 1 addition & 1 deletion tests/test_diffpyparset.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def _testLattice():
a1.xyz[1] = 0.123
a1.U11 = 0.321
a1.B32 = 0.111
dsstru.lattice.setLatPar(a=3.0, gamma=121)
dsstru.lattice.set_latt_parms(a=3.0, gamma=121)
_testAtoms()
_testLattice()

Expand Down
8 changes: 6 additions & 2 deletions tests/test_fitrecipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,9 +529,13 @@ def test_initialize_recipe_from_results_object(build_recipes_one_contribution):
assert actual_names_before_init == expected_names_before_init
recipe2.initialize_recipe_with_results(results1)
optimize_recipe(recipe2)
# Fix extra_var to prevent divide by zero warnings when tests run.
recipe2.fix("extra_var")
results2 = FitResults(recipe2)
actual_values = sorted(np.round(results2.varvals, 5).tolist())
actual_names = sorted(results2.varnames)
actual_values = sorted(
np.round(np.append(results2.varvals, results2.fixedvals), 5).tolist()
)
actual_names = sorted(results2.varnames + results2.fixednames)

# Add the name and value of the new variable to the expected ones.
expected_names = sorted(expected_names + ["extra_var"])
Expand Down
Loading