|
6 | 6 |
|
7 | 7 | import unittest |
8 | 8 |
|
| 9 | +from diffpy.structure import Structure |
| 10 | +from diffpy.pdfgui.control.pdfstructure import PDFStructure |
9 | 11 | from diffpy.pdfgui.control.fitstructure import FitStructure |
10 | 12 | from diffpy.pdfgui.control.constraint import Constraint |
11 | 13 | from diffpy.pdfgui.tests.testutils import datafile |
| 14 | +from diffpy.pdfgui.control.controlerrors import ControlTypeError |
12 | 15 |
|
| 16 | +# ---------------------------------------------------------------------------- |
13 | 17 |
|
14 | | -############################################################################## |
15 | 18 | class TestFitStructure(unittest.TestCase): |
16 | 19 |
|
17 | 20 |
|
@@ -265,14 +268,22 @@ def test_getPairSelectionFlags(self): |
265 | 268 | # """check FitStructure.applyPairSelection() |
266 | 269 | # """ |
267 | 270 | # 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 | + |
276 | 287 | # def test_load(self): |
277 | 288 | # """check FitStructure.load() |
278 | 289 | # """ |
@@ -305,6 +316,7 @@ def test_getPairSelectionFlags(self): |
305 | 316 |
|
306 | 317 | # End of class TestFitStructure |
307 | 318 |
|
| 319 | +# ---------------------------------------------------------------------------- |
308 | 320 |
|
309 | 321 | if __name__ == '__main__': |
310 | 322 | unittest.main() |
|
0 commit comments