From 59f94716f04be33b01b6a6e97a681b255e6a99cd Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Sat, 11 Jan 2025 09:58:02 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit hooks --- tests/conftest.py | 3 ++- tests/test_atomradiitable.py | 3 +++ tests/test_bondcalculator.py | 9 +++------ tests/test_bvscalculator.py | 3 ++- tests/test_debyepdfcalculator.py | 2 +- tests/test_overlapcalculator.py | 9 +++------ tests/test_pairquantity.py | 2 +- tests/test_parallel.py | 2 +- tests/test_pdfbaseline.py | 2 +- tests/test_pdfcalcobjcryst.py | 5 +++-- tests/test_pdfcalculator.py | 2 +- tests/test_pdfenvelope.py | 2 +- tests/test_peakprofile.py | 2 +- tests/test_peakwidthmodel.py | 3 ++- tests/test_scatteringfactortable.py | 2 +- tests/test_sfaverage.py | 8 +++----- tests/test_structureadapter.py | 21 +++++++++++---------- tests/testutils.py | 4 ++-- 18 files changed, 42 insertions(+), 42 deletions(-) diff --git a/tests/conftest.py b/tests/conftest.py index 81a85fc..273cc36 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,8 +4,8 @@ import pytest -from diffpy.srreal.structureconverters import convertObjCrystCrystal import diffpy.structure as mod_structure +from diffpy.srreal.structureconverters import convertObjCrystCrystal @pytest.fixture @@ -37,6 +37,7 @@ def _msg_nopyobjcryst(): def has_pyobjcryst(): try: import pyobjcryst.crystal + convertObjCrystCrystal(pyobjcryst.crystal.Crystal()) has_pyobjcryst = True except ImportError: diff --git a/tests/test_atomradiitable.py b/tests/test_atomradiitable.py index fc4ead6..158a6f4 100644 --- a/tests/test_atomradiitable.py +++ b/tests/test_atomradiitable.py @@ -5,12 +5,14 @@ import pickle import unittest + import pytest from diffpy.srreal.atomradiitable import AtomRadiiTable, ConstantRadiiTable, CovalentRadiiTable # ---------------------------------------------------------------------------- + class TestAtomRadiiTable(unittest.TestCase): def setUp(self): self.rtb = AtomRadiiTable() @@ -100,6 +102,7 @@ def test_toString(self): # ---------------------------------------------------------------------------- + class TestCovalentRadiiTable(unittest.TestCase): @pytest.fixture(autouse=True) diff --git a/tests/test_bondcalculator.py b/tests/test_bondcalculator.py index 47fcc28..cd69fe5 100644 --- a/tests/test_bondcalculator.py +++ b/tests/test_bondcalculator.py @@ -5,16 +5,12 @@ import pickle import unittest -import pytest import numpy +import pytest +from testutils import loadDiffPyStructure, loadObjCrystCrystal, pickle_with_attr from diffpy.srreal.bondcalculator import BondCalculator -from testutils import ( - loadDiffPyStructure, - loadObjCrystCrystal, - pickle_with_attr, -) # ---------------------------------------------------------------------------- @@ -247,6 +243,7 @@ def test_setTypeMask(self): # ---------------------------------------------------------------------------- + class TestBondCalculatorObjCryst(unittest.TestCase): @pytest.fixture(autouse=True) diff --git a/tests/test_bvscalculator.py b/tests/test_bvscalculator.py index 3e93601..c2f3838 100644 --- a/tests/test_bvscalculator.py +++ b/tests/test_bvscalculator.py @@ -6,9 +6,10 @@ import pickle import unittest -from diffpy.srreal.bvscalculator import BVSCalculator from testutils import loadDiffPyStructure, pickle_with_attr +from diffpy.srreal.bvscalculator import BVSCalculator + ############################################################################## class TestBVSCalculator(unittest.TestCase): diff --git a/tests/test_debyepdfcalculator.py b/tests/test_debyepdfcalculator.py index 65e04a0..693a7ab 100644 --- a/tests/test_debyepdfcalculator.py +++ b/tests/test_debyepdfcalculator.py @@ -7,9 +7,9 @@ import unittest import numpy +from testutils import _maxNormDiff, loadDiffPyStructure, pickle_with_attr from diffpy.srreal.pdfcalculator import DebyePDFCalculator, PDFCalculator -from testutils import loadDiffPyStructure, pickle_with_attr, _maxNormDiff ############################################################################## diff --git a/tests/test_overlapcalculator.py b/tests/test_overlapcalculator.py index 6b410c9..5a7a204 100644 --- a/tests/test_overlapcalculator.py +++ b/tests/test_overlapcalculator.py @@ -6,17 +6,13 @@ import copy import pickle import unittest -import pytest import numpy +import pytest +from testutils import loadDiffPyStructure, loadObjCrystCrystal, pickle_with_attr from diffpy.srreal.atomradiitable import CovalentRadiiTable from diffpy.srreal.overlapcalculator import OverlapCalculator -from testutils import ( - loadDiffPyStructure, - loadObjCrystCrystal, - pickle_with_attr, -) # ---------------------------------------------------------------------------- @@ -330,6 +326,7 @@ def test_neighborhoods(self): # ---------------------------------------------------------------------------- + class TestOverlapCalculatorObjCryst(unittest.TestCase): @pytest.fixture(autouse=True) diff --git a/tests/test_pairquantity.py b/tests/test_pairquantity.py index 689883a..01e3bd9 100644 --- a/tests/test_pairquantity.py +++ b/tests/test_pairquantity.py @@ -6,11 +6,11 @@ import unittest import numpy +from testutils import mod_structure from diffpy.srreal.pairquantity import PairQuantity from diffpy.srreal.pdfcalculator import PDFCalculator from diffpy.srreal.srreal_ext import BasePairQuantity -from testutils import mod_structure # ---------------------------------------------------------------------------- diff --git a/tests/test_parallel.py b/tests/test_parallel.py index 050cd22..3bc524c 100644 --- a/tests/test_parallel.py +++ b/tests/test_parallel.py @@ -7,9 +7,9 @@ import unittest import numpy +from testutils import loadDiffPyStructure from diffpy.srreal.parallel import createParallelCalculator -from testutils import loadDiffPyStructure ############################################################################## diff --git a/tests/test_pdfbaseline.py b/tests/test_pdfbaseline.py index 8e07d78..20535ce 100644 --- a/tests/test_pdfbaseline.py +++ b/tests/test_pdfbaseline.py @@ -7,10 +7,10 @@ import unittest import numpy +from testutils import pickle_with_attr from diffpy.srreal.pdfbaseline import LinearBaseline, PDFBaseline, ZeroBaseline, makePDFBaseline from diffpy.srreal.pdfcalculator import PDFCalculator -from testutils import pickle_with_attr # ---------------------------------------------------------------------------- diff --git a/tests/test_pdfcalcobjcryst.py b/tests/test_pdfcalcobjcryst.py index 980a71f..3fd4d4c 100644 --- a/tests/test_pdfcalcobjcryst.py +++ b/tests/test_pdfcalcobjcryst.py @@ -5,12 +5,12 @@ import re import unittest -import pytest import numpy +import pytest +from testutils import _maxNormDiff, datafile, loadObjCrystCrystal from diffpy.srreal.pdfcalculator import PDFCalculator -from testutils import datafile, loadObjCrystCrystal, _maxNormDiff # helper functions @@ -58,6 +58,7 @@ def _makePDFCalculator(crst, cfgdict): # ---------------------------------------------------------------------------- + class TestPDFCalcObjcryst(unittest.TestCase): @pytest.fixture(autouse=True) diff --git a/tests/test_pdfcalculator.py b/tests/test_pdfcalculator.py index a27e84d..ef45a6b 100644 --- a/tests/test_pdfcalculator.py +++ b/tests/test_pdfcalculator.py @@ -7,9 +7,9 @@ import unittest import numpy +from testutils import _maxNormDiff, datafile, loadDiffPyStructure, pickle_with_attr from diffpy.srreal.pdfcalculator import PDFCalculator, fftftog, fftgtof -from testutils import datafile, loadDiffPyStructure, pickle_with_attr, _maxNormDiff # helper functions diff --git a/tests/test_pdfenvelope.py b/tests/test_pdfenvelope.py index f6493f2..7ea75f4 100644 --- a/tests/test_pdfenvelope.py +++ b/tests/test_pdfenvelope.py @@ -7,6 +7,7 @@ import unittest import numpy +from testutils import pickle_with_attr from diffpy.srreal.pdfcalculator import DebyePDFCalculator, PDFCalculator from diffpy.srreal.pdfenvelope import ( @@ -17,7 +18,6 @@ StepCutEnvelope, makePDFEnvelope, ) -from testutils import pickle_with_attr # ---------------------------------------------------------------------------- diff --git a/tests/test_peakprofile.py b/tests/test_peakprofile.py index 8676afd..9b739c1 100644 --- a/tests/test_peakprofile.py +++ b/tests/test_peakprofile.py @@ -7,10 +7,10 @@ import unittest import numpy +from testutils import mod_structure, pickle_with_attr from diffpy.srreal.pdfcalculator import PDFCalculator from diffpy.srreal.peakprofile import PeakProfile -from testutils import mod_structure, pickle_with_attr # ---------------------------------------------------------------------------- diff --git a/tests/test_peakwidthmodel.py b/tests/test_peakwidthmodel.py index 6b8e25a..6c83cd1 100644 --- a/tests/test_peakwidthmodel.py +++ b/tests/test_peakwidthmodel.py @@ -7,10 +7,11 @@ import pickle import unittest +from testutils import loadDiffPyStructure + from diffpy.srreal.pdfcalculator import DebyePDFCalculator, PDFCalculator from diffpy.srreal.peakwidthmodel import DebyeWallerPeakWidth, JeongPeakWidth, PeakWidthModel from diffpy.srreal.structureadapter import createStructureAdapter -from testutils import loadDiffPyStructure # ---------------------------------------------------------------------------- diff --git a/tests/test_scatteringfactortable.py b/tests/test_scatteringfactortable.py index 48d1efe..3d327ae 100644 --- a/tests/test_scatteringfactortable.py +++ b/tests/test_scatteringfactortable.py @@ -7,6 +7,7 @@ import unittest import numpy +from testutils import pickle_with_attr from diffpy.srreal.pdfcalculator import DebyePDFCalculator, PDFCalculator from diffpy.srreal.scatteringfactortable import ( @@ -16,7 +17,6 @@ SFTNeutron, SFTXray, ) -from testutils import pickle_with_attr # ---------------------------------------------------------------------------- diff --git a/tests/test_sfaverage.py b/tests/test_sfaverage.py index 78d39fd..87dd9a1 100644 --- a/tests/test_sfaverage.py +++ b/tests/test_sfaverage.py @@ -4,16 +4,13 @@ import unittest -import pytest import numpy +import pytest +from testutils import loadDiffPyStructure, loadObjCrystCrystal from diffpy.srreal.scatteringfactortable import ScatteringFactorTable from diffpy.srreal.sfaverage import SFAverage -from testutils import ( - loadDiffPyStructure, - loadObjCrystCrystal, -) # ---------------------------------------------------------------------------- @@ -76,6 +73,7 @@ def test_fromComposition(self): # ---------------------------------------------------------------------------- + class TestSFAverageObjCryst(unittest.TestCase): @pytest.fixture(autouse=True) diff --git a/tests/test_structureadapter.py b/tests/test_structureadapter.py index 6cd69a3..697c355 100644 --- a/tests/test_structureadapter.py +++ b/tests/test_structureadapter.py @@ -5,9 +5,18 @@ import pickle import unittest -import pytest import numpy +import pytest +from testutils import ( + DerivedAtomicStructureAdapter, + DerivedCrystalStructureAdapter, + DerivedPeriodicStructureAdapter, + DerivedStructureAdapter, + loadCrystalStructureAdapter, + loadDiffPyStructure, + loadObjCrystCrystal, +) from diffpy.srreal.pdfcalculator import PDFCalculator from diffpy.srreal.structureadapter import ( @@ -20,15 +29,6 @@ nometa, nosymmetry, ) -from testutils import ( - loadCrystalStructureAdapter, - loadDiffPyStructure, - loadObjCrystCrystal, - DerivedStructureAdapter, - DerivedAtomicStructureAdapter, - DerivedPeriodicStructureAdapter, - DerivedCrystalStructureAdapter -) # ---------------------------------------------------------------------------- @@ -269,6 +269,7 @@ def test_nosymmetry_pickling(self): # ---------------------------------------------------------------------------- + class TestPyObjCrystAdapter(unittest.TestCase): @pytest.fixture(autouse=True) diff --git a/tests/testutils.py b/tests/testutils.py index d68dd99..5f594af 100644 --- a/tests/testutils.py +++ b/tests/testutils.py @@ -8,16 +8,15 @@ import numpy +import diffpy.structure as mod_structure from diffpy.srreal.structureadapter import ( AtomicStructureAdapter, CrystalStructureAdapter, PeriodicStructureAdapter, StructureAdapter, ) -import diffpy.structure as mod_structure from diffpy.structure.parsers import getParser - # helper functions @@ -73,6 +72,7 @@ def _maxNormDiff(yobs, ycalc): rv = max(numpy.fabs(ynmdiff)) return rv + # helper class for testing overloading of StructureAdapter