diff --git a/news/intro.rst b/news/intro.rst new file mode 100644 index 0000000..d0a911b --- /dev/null +++ b/news/intro.rst @@ -0,0 +1,23 @@ +**Added:** + +* Option to skip printing of introductory information when initializing the `PdfFit` class. + +**Changed:** + +* + +**Deprecated:** + +* + +**Removed:** + +* + +**Fixed:** + +* + +**Security:** + +* diff --git a/src/diffpy/pdffit2/pdffit.py b/src/diffpy/pdffit2/pdffit.py index 392ef07..43e9763 100644 --- a/src/diffpy/pdffit2/pdffit.py +++ b/src/diffpy/pdffit2/pdffit.py @@ -104,7 +104,15 @@ def _convertCallable(var): class PdfFit(object): - """Create PdfFit object.""" + """Class for PdfFit. + + Attributes + ---------- + stru_files : list + The list to store structure files. + data_files : list + The list to store data files. + """ # constants and enumerators from pdffit.h: # selection of all atoms @@ -1252,13 +1260,22 @@ def rcut(): # End refinable variables. - def __init__(self): + def __init__(self, create_intro=True): + """Initialize the Pdffit class, create a new PdfFit object. + + Parameters + ---------- + create_intro : bool, optional + The flag to control the display of an introduction message. + If True, display an introduction message, else not. Default is True. + """ self.stru_files = [] self.data_files = [] self._handle = pdffit2.create() - self.intro() + if create_intro: + self.intro() return def __getRef(self, var_string): diff --git a/tests/test_pdffit.py b/tests/test_pdffit.py index 508f29f..ee1e715 100644 --- a/tests/test_pdffit.py +++ b/tests/test_pdffit.py @@ -702,56 +702,63 @@ def test_occ(self): self.assertEqual(1, pf.getvar(pf.occ(i))) return + # def test_pscale(self): + # """check PdfFit.pscale() + # """ + # return + # + # def test_pscale(self): + # """check PdfFit.pscale() + # """ + # return + # + # def test_sratio(self): + # """check PdfFit.sratio() + # """ + # return + # + # def test_delta1(self): + # """check PdfFit.delta1() + # """ + # return + # + # def test_delta2(self): + # """check PdfFit.delta2() + # """ + # return + # + # def test_dscale(self): + # """check PdfFit.dscale() + # """ + # return + # + # def test_qdamp(self): + # """check PdfFit.qdamp() + # """ + # return + # + # def test_qbroad(self): + # """check PdfFit.qbroad() + # """ + # return + # + # def test_rcut(self): + # """check PdfFit.rcut() + # """ + # return + # + + def test___init__(self): + """Check PdfFit.__init__()""" + output_true = self.capture_output(PdfFit, create_intro=True).strip() + output_false = self.capture_output(PdfFit, create_intro=False).strip() + + self.assertGreater(len(output_true), 0) + self.assertEqual(len(output_false), 0) + + return + -# def test_pscale(self): -# """check PdfFit.pscale() -# """ -# return -# -# def test_pscale(self): -# """check PdfFit.pscale() -# """ -# return -# -# def test_sratio(self): -# """check PdfFit.sratio() -# """ -# return -# -# def test_delta1(self): -# """check PdfFit.delta1() -# """ -# return -# -# def test_delta2(self): -# """check PdfFit.delta2() -# """ -# return -# -# def test_dscale(self): -# """check PdfFit.dscale() -# """ -# return -# -# def test_qdamp(self): -# """check PdfFit.qdamp() -# """ -# return -# -# def test_qbroad(self): -# """check PdfFit.qbroad() -# """ -# return -# -# def test_rcut(self): -# """check PdfFit.rcut() -# """ -# return -# -# def test___init__(self): -# """check PdfFit.__init__() -# """ -# return # # def test__PdfFit__getRef(self): # """check PdfFit._PdfFit__getRef()