Skip to content

Commit 49be617

Browse files
committed
TST: partially cover FitStructure class
1 parent 4182a99 commit 49be617

1 file changed

Lines changed: 21 additions & 9 deletions

File tree

src/diffpy/pdfgui/tests/TestFitStructure.py

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,15 @@
66

77
import unittest
88

9+
from diffpy.structure import Structure
10+
from diffpy.pdfgui.control.pdfstructure import PDFStructure
911
from diffpy.pdfgui.control.fitstructure import FitStructure
1012
from diffpy.pdfgui.control.constraint import Constraint
1113
from diffpy.pdfgui.tests.testutils import datafile
14+
from diffpy.pdfgui.control.controlerrors import ControlTypeError
1215

16+
# ----------------------------------------------------------------------------
1317

14-
##############################################################################
1518
class TestFitStructure(unittest.TestCase):
1619

1720

@@ -265,14 +268,22 @@ def test_getPairSelectionFlags(self):
265268
# """check FitStructure.applyPairSelection()
266269
# """
267270
# return
268-
#
269-
#
270-
# def test_copy(self):
271-
# """check FitStructure.copy()
272-
# """
273-
# return
274-
#
275-
#
271+
272+
273+
def test_copy(self):
274+
"""check FitStructure.copy()
275+
"""
276+
stru2 = self.stru.copy()
277+
self.assertEqual('noname', stru2.name)
278+
stru3 = Structure()
279+
self.assertRaises(ControlTypeError, stru2.copy, stru3)
280+
self.stru.refined = PDFStructure('refined-name')
281+
stru4 = self.stru.copy()
282+
self.assertIsNot(self.stru.refined, stru4.refined)
283+
self.assertEqual('refined-name', stru4.refined.name)
284+
return
285+
286+
276287
# def test_load(self):
277288
# """check FitStructure.load()
278289
# """
@@ -305,6 +316,7 @@ def test_getPairSelectionFlags(self):
305316

306317
# End of class TestFitStructure
307318

319+
# ----------------------------------------------------------------------------
308320

309321
if __name__ == '__main__':
310322
unittest.main()

0 commit comments

Comments
 (0)