Skip to content

Commit b3b654f

Browse files
committed
doc: docstring to numpy style
1 parent 93c88be commit b3b654f

File tree

2 files changed

+17
-22
lines changed

2 files changed

+17
-22
lines changed

src/diffpy/pdffit2/pdffit.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,15 @@ def _convertCallable(var):
104104

105105

106106
class PdfFit(object):
107+
"""Class for PdfFit.
108+
109+
Attributes
110+
----------
111+
stru_files : list
112+
The list to store structure files.
113+
data_files : list
114+
The list to store data files.
115+
"""
107116

108117
# constants and enumerators from pdffit.h:
109118
# selection of all atoms
@@ -1251,29 +1260,21 @@ def rcut():
12511260

12521261
# End refinable variables.
12531262

1254-
def __init__(self, intro=True):
1263+
def __init__(self, create_intro=True):
12551264
"""Initialize the Pdffit class, create a new PdfFit object.
12561265
12571266
Parameters
12581267
----------
1259-
intro : bool, optional
1260-
If True, display an introduction message. Default is True.
1261-
1262-
Attributes
1263-
----------
1264-
stru_files : list
1265-
A list to store structure files.
1266-
data_files : list
1267-
A list to store data files.
1268-
_handle : PyCapsule
1269-
A python capsules to retrieve the printer to PdfFit object.
1268+
create_intro : bool, optional
1269+
The flag to control the display of an introduction message.
1270+
If True, display an introduction message, else not. Default is True.
12701271
"""
12711272

12721273
self.stru_files = []
12731274
self.data_files = []
12741275

12751276
self._handle = pdffit2.create()
1276-
if intro:
1277+
if create_intro:
12771278
self.intro()
12781279
return
12791280

tests/test_pdffit.py

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -750,16 +750,10 @@ def test_occ(self):
750750

751751
def test___init__(self):
752752
"""Check PdfFit.__init__()"""
753-
P = PdfFit()
754-
self.assertEqual([], P.stru_files)
755-
self.assertEqual([], P.data_files)
753+
output_true = self.capture_output(PdfFit, create_intro=True).strip()
754+
output_false = self.capture_output(PdfFit, create_intro=False).strip()
756755

757-
output_true = self.capture_output(PdfFit, intro=True).strip()
758-
output_false = self.capture_output(PdfFit, intro=False).strip()
759-
760-
import diffpy.pdffit2.pdffit as pdffit
761-
762-
self.assertEqual(len(output_true), len(pdffit.__intro_message__.strip()))
756+
self.assertGreater(len(output_true), 0)
763757
self.assertEqual(len(output_false), 0)
764758

765759
return

0 commit comments

Comments
 (0)