Skip to content

Commit 44792a2

Browse files
authored
Merge pull request #120 from Tieqiong/intro
feat: add option to skip copyright header
2 parents b94c6a9 + b3b654f commit 44792a2

File tree

3 files changed

+99
-52
lines changed

3 files changed

+99
-52
lines changed

news/intro.rst

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
**Added:**
2+
3+
* Option to skip printing of introductory information when initializing the `PdfFit` class.
4+
5+
**Changed:**
6+
7+
* <news item>
8+
9+
**Deprecated:**
10+
11+
* <news item>
12+
13+
**Removed:**
14+
15+
* <news item>
16+
17+
**Fixed:**
18+
19+
* <news item>
20+
21+
**Security:**
22+
23+
* <news item>

src/diffpy/pdffit2/pdffit.py

+20-3
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,15 @@ def _convertCallable(var):
104104

105105

106106
class PdfFit(object):
107-
"""Create 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+
"""
108116

109117
# constants and enumerators from pdffit.h:
110118
# selection of all atoms
@@ -1252,13 +1260,22 @@ def rcut():
12521260

12531261
# End refinable variables.
12541262

1255-
def __init__(self):
1263+
def __init__(self, create_intro=True):
1264+
"""Initialize the Pdffit class, create a new PdfFit object.
1265+
1266+
Parameters
1267+
----------
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.
1271+
"""
12561272

12571273
self.stru_files = []
12581274
self.data_files = []
12591275

12601276
self._handle = pdffit2.create()
1261-
self.intro()
1277+
if create_intro:
1278+
self.intro()
12621279
return
12631280

12641281
def __getRef(self, var_string):

tests/test_pdffit.py

+56-49
Original file line numberDiff line numberDiff line change
@@ -702,56 +702,63 @@ def test_occ(self):
702702
self.assertEqual(1, pf.getvar(pf.occ(i)))
703703
return
704704

705+
# def test_pscale(self):
706+
# """check PdfFit.pscale()
707+
# """
708+
# return
709+
#
710+
# def test_pscale(self):
711+
# """check PdfFit.pscale()
712+
# """
713+
# return
714+
#
715+
# def test_sratio(self):
716+
# """check PdfFit.sratio()
717+
# """
718+
# return
719+
#
720+
# def test_delta1(self):
721+
# """check PdfFit.delta1()
722+
# """
723+
# return
724+
#
725+
# def test_delta2(self):
726+
# """check PdfFit.delta2()
727+
# """
728+
# return
729+
#
730+
# def test_dscale(self):
731+
# """check PdfFit.dscale()
732+
# """
733+
# return
734+
#
735+
# def test_qdamp(self):
736+
# """check PdfFit.qdamp()
737+
# """
738+
# return
739+
#
740+
# def test_qbroad(self):
741+
# """check PdfFit.qbroad()
742+
# """
743+
# return
744+
#
745+
# def test_rcut(self):
746+
# """check PdfFit.rcut()
747+
# """
748+
# return
749+
#
750+
751+
def test___init__(self):
752+
"""Check PdfFit.__init__()"""
753+
output_true = self.capture_output(PdfFit, create_intro=True).strip()
754+
output_false = self.capture_output(PdfFit, create_intro=False).strip()
755+
756+
self.assertGreater(len(output_true), 0)
757+
self.assertEqual(len(output_false), 0)
758+
759+
return
760+
705761

706-
# def test_pscale(self):
707-
# """check PdfFit.pscale()
708-
# """
709-
# return
710-
#
711-
# def test_pscale(self):
712-
# """check PdfFit.pscale()
713-
# """
714-
# return
715-
#
716-
# def test_sratio(self):
717-
# """check PdfFit.sratio()
718-
# """
719-
# return
720-
#
721-
# def test_delta1(self):
722-
# """check PdfFit.delta1()
723-
# """
724-
# return
725-
#
726-
# def test_delta2(self):
727-
# """check PdfFit.delta2()
728-
# """
729-
# return
730-
#
731-
# def test_dscale(self):
732-
# """check PdfFit.dscale()
733-
# """
734-
# return
735-
#
736-
# def test_qdamp(self):
737-
# """check PdfFit.qdamp()
738-
# """
739-
# return
740-
#
741-
# def test_qbroad(self):
742-
# """check PdfFit.qbroad()
743-
# """
744-
# return
745-
#
746-
# def test_rcut(self):
747-
# """check PdfFit.rcut()
748-
# """
749-
# return
750-
#
751-
# def test___init__(self):
752-
# """check PdfFit.__init__()
753-
# """
754-
# return
755762
#
756763
# def test__PdfFit__getRef(self):
757764
# """check PdfFit._PdfFit__getRef()

0 commit comments

Comments
 (0)