From 0752ce92dc211243ee1c085b0dd10155c334be6f Mon Sep 17 00:00:00 2001 From: Yuchen Ethan Xiao Date: Mon, 4 Aug 2025 14:59:18 -0400 Subject: [PATCH 1/2] test: use filename string instead of pathlib.Path to fix tests using `diffpy.structure` --- news/use-string-in-structure | 23 +++++++++++++++++++++++ tests/test_pdf.py | 5 ++++- 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 news/use-string-in-structure diff --git a/news/use-string-in-structure b/news/use-string-in-structure new file mode 100644 index 0000000..da1c8a0 --- /dev/null +++ b/news/use-string-in-structure @@ -0,0 +1,23 @@ +**Added:** + +* No news added: Use filename string instead of pathlib.Path to fix the test using ``diffpy.structure``. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/tests/test_pdf.py b/tests/test_pdf.py index 929b16e..03a50cf 100644 --- a/tests/test_pdf.py +++ b/tests/test_pdf.py @@ -160,6 +160,7 @@ def testGenerator( stru = PDFFitStructure() ciffile = datafile("ni.cif") + ciffile = str(ciffile) stru.read(ciffile) for i in range(4): stru[i].Bisoequiv = 1 @@ -298,7 +299,9 @@ def test_pickling( pc = PDFContribution("pdf") pc.loadData(datafile("ni-q27r100-neutron.gr")) - ni = loadStructure(datafile("ni.cif")) + ciffile = datafile("ni.cif") + ciffile = str(ciffile) + ni = loadStructure(ciffile) ni.Uisoequiv = 0.003 pc.addStructure("ni", ni) pc.setCalculationRange(0, 10) From 685e8d5fe0be6c41dc0e896951bc7940b57bbbff Mon Sep 17 00:00:00 2001 From: Yuchen Ethan Xiao Date: Mon, 4 Aug 2025 18:47:09 -0400 Subject: [PATCH 2/2] chore: rename `ciffile` to `cif_path` --- tests/test_pdf.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_pdf.py b/tests/test_pdf.py index 03a50cf..c6cffd1 100644 --- a/tests/test_pdf.py +++ b/tests/test_pdf.py @@ -160,8 +160,8 @@ def testGenerator( stru = PDFFitStructure() ciffile = datafile("ni.cif") - ciffile = str(ciffile) - stru.read(ciffile) + cif_path = str(ciffile) + stru.read(cif_path) for i in range(4): stru[i].Bisoequiv = 1 gen.setStructure(stru) @@ -300,8 +300,8 @@ def test_pickling( pc = PDFContribution("pdf") pc.loadData(datafile("ni-q27r100-neutron.gr")) ciffile = datafile("ni.cif") - ciffile = str(ciffile) - ni = loadStructure(ciffile) + cif_path = str(ciffile) + ni = loadStructure(cif_path) ni.Uisoequiv = 0.003 pc.addStructure("ni", ni) pc.setCalculationRange(0, 10)