def test_contactinfo_to_xml(qtbot): widget = ContactInfo.ContactInfo() qtbot.addWidget(widget) widget.findChild(QLineEdit, 'fgdc_cntper').setText("Jay Diffendorfer") widget.findChild(QLineEdit, 'fgdc_cntpos').setText("") widget.findChild(QLineEdit, 'fgdc_cntvoice').setText("303-236-5369") widget.findChild(QLineEdit, 'fgdc_cntemail').setText("*****@*****.**") widget.findChild(QLineEdit, 'fgdc_postal').setText("80225") cntinfo = widget.to_xml() assert etree.tostring(cntinfo, pretty_print=True).decode() \ == """<cntinfo>
def test_contactinfo_from_xml(qtbot): widget = ContactInfo.ContactInfo() qtbot.addWidget(widget) test_record_fname = "tests/data/Onshore_Industrial_Wind_Turbine_Locations_for_the_United_States_through_July2013.xml" test_record = etree.parse(test_record_fname) contact = test_record.xpath("idinfo/ptcontac/cntinfo")[0] widget.from_xml(contact) assert widget.findChild(QLineEdit, 'fgdc_cntper').text() == "Jay Diffendorfer" assert widget.findChild(QLineEdit, 'fgdc_cntpos').text() == "" assert widget.findChild(QLineEdit, 'fgdc_cntvoice').text() == "303-236-5369" assert widget.findChild( QLineEdit, 'fgdc_cntemail').text() == "*****@*****.**" assert widget.findChild(QLineEdit, 'fgdc_postal').text() == "80225"
def build_ui(self): """ Build and modify this widget's GUI Returns ------- None """ self.ui = UI_proccont.Ui_USGSContactInfoWidgetMain() self.ui.setupUi(self) self.setup_dragdrop(self) self.cntinfo = ContactInfo.ContactInfo() self.ui.main_layout.addWidget(self.cntinfo) self.collaped_size = QSize(self.WIDGET_WIDTH, self.COLLAPSED_HEIGHT) self.expanded_size = QSize(self.WIDGET_WIDTH, self.EXPANDED_HEIGHT) self.resize(self.collaped_size) self.setObjectName("ptcontac")