Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
[pre-commit.ci] auto fixes from pre-commit hooks
  • Loading branch information
pre-commit-ci[bot] committed Jan 11, 2025
commit 59f94716f04be33b01b6a6e97a681b255e6a99cd
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -37,6 +37,7 @@ def _msg_nopyobjcryst():
def has_pyobjcryst():
try:
import pyobjcryst.crystal

convertObjCrystCrystal(pyobjcryst.crystal.Crystal())
has_pyobjcryst = True
except ImportError:
Expand Down
3 changes: 3 additions & 0 deletions tests/test_atomradiitable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -100,6 +102,7 @@ def test_toString(self):

# ----------------------------------------------------------------------------


class TestCovalentRadiiTable(unittest.TestCase):

@pytest.fixture(autouse=True)
Expand Down
9 changes: 3 additions & 6 deletions tests/test_bondcalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

# ----------------------------------------------------------------------------

Expand Down Expand Up @@ -247,6 +243,7 @@ def test_setTypeMask(self):

# ----------------------------------------------------------------------------


class TestBondCalculatorObjCryst(unittest.TestCase):

@pytest.fixture(autouse=True)
Expand Down
3 changes: 2 additions & 1 deletion tests/test_bvscalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_debyepdfcalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


##############################################################################
Expand Down
9 changes: 3 additions & 6 deletions tests/test_overlapcalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

# ----------------------------------------------------------------------------

Expand Down Expand Up @@ -330,6 +326,7 @@ def test_neighborhoods(self):

# ----------------------------------------------------------------------------


class TestOverlapCalculatorObjCryst(unittest.TestCase):

@pytest.fixture(autouse=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pairquantity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

# ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion tests/test_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
import unittest

import numpy
from testutils import loadDiffPyStructure

from diffpy.srreal.parallel import createParallelCalculator
from testutils import loadDiffPyStructure


##############################################################################
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pdfbaseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

# ----------------------------------------------------------------------------

Expand Down
5 changes: 3 additions & 2 deletions tests/test_pdfcalcobjcryst.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -58,6 +58,7 @@ def _makePDFCalculator(crst, cfgdict):

# ----------------------------------------------------------------------------


class TestPDFCalcObjcryst(unittest.TestCase):

@pytest.fixture(autouse=True)
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pdfcalculator.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion tests/test_pdfenvelope.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -17,7 +18,6 @@
StepCutEnvelope,
makePDFEnvelope,
)
from testutils import pickle_with_attr

# ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion tests/test_peakprofile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

# ----------------------------------------------------------------------------

Expand Down
3 changes: 2 additions & 1 deletion tests/test_peakwidthmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

# ----------------------------------------------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion tests/test_scatteringfactortable.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -16,7 +17,6 @@
SFTNeutron,
SFTXray,
)
from testutils import pickle_with_attr

# ----------------------------------------------------------------------------

Expand Down
8 changes: 3 additions & 5 deletions tests/test_sfaverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

# ----------------------------------------------------------------------------

Expand Down Expand Up @@ -76,6 +73,7 @@ def test_fromComposition(self):

# ----------------------------------------------------------------------------


class TestSFAverageObjCryst(unittest.TestCase):

@pytest.fixture(autouse=True)
Expand Down
21 changes: 11 additions & 10 deletions tests/test_structureadapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand All @@ -20,15 +29,6 @@
nometa,
nosymmetry,
)
from testutils import (
loadCrystalStructureAdapter,
loadDiffPyStructure,
loadObjCrystCrystal,
DerivedStructureAdapter,
DerivedAtomicStructureAdapter,
DerivedPeriodicStructureAdapter,
DerivedCrystalStructureAdapter
)

# ----------------------------------------------------------------------------

Expand Down Expand Up @@ -269,6 +269,7 @@ def test_nosymmetry_pickling(self):

# ----------------------------------------------------------------------------


class TestPyObjCrystAdapter(unittest.TestCase):

@pytest.fixture(autouse=True)
Expand Down
4 changes: 2 additions & 2 deletions tests/testutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down Expand Up @@ -73,6 +72,7 @@ def _maxNormDiff(yobs, ycalc):
rv = max(numpy.fabs(ynmdiff))
return rv


# helper class for testing overloading of StructureAdapter


Expand Down