def test_wrong_icon(self): wrong_name = "random_icon_non_existing" with self.assertRaisesRegex( AttributeError, 'The requested icon "{}" does not exist.\nOnly the following icons are available:' .format(wrong_name)): utilities.CreateInformativeMessageBox("my_text", wrong_name)
def test_ok_key(self): base_args = ["some text", "NoIcon"] # those are always needed additional_args = [[], ["inform_Text"], ["inform_Text", "detailed_text"]] for args in additional_args: all_args = base_args + args with self.subTest(all_args=all_args): mbx = utilities.CreateInformativeMessageBox( *all_args, fct_ptr=SingleShotOkKlick ) # args need to be passed then it blocks! # only pass detailed but not informative text with self.subTest(detailed_text=additional_args[2][1]): mbx = utilities.CreateInformativeMessageBox( *base_args, detailed_text=additional_args[2][1], fct_ptr=SingleShotOkKlick ) # args need to be passed then it blocks!
def test_basics(self): my_text = "some_text that has nothing" def CheckFct(message_box): SingleShotOkKlick(message_box) self.assertEqual(message_box.text(), my_text) self.assertEqual(message_box.informativeText(), "") self.assertEqual(message_box.detailedText(), "") utilities.CreateInformativeMessageBox(my_text, "NoIcon", fct_ptr=CheckFct)
def test_informative_text(self): my_text = "some_text that has a little bit" inform_text = "Here some more info is provided!" def CheckFct(message_box): SingleShotOkKlick(message_box) self.assertEqual(message_box.text(), my_text) self.assertEqual(message_box.informativeText(), inform_text) self.assertEqual(message_box.detailedText(), "") utilities.CreateInformativeMessageBox(my_text, "NoIcon", inform_text, fct_ptr=CheckFct)
def test_detailed_text(self): my_text = "some_text that has a a lot!" inform_text = "Here some more info is kinda provided!" det_text = "This is some pretty detailed information\nEven more!!" def CheckFct(message_box): SingleShotOkKlick(message_box) self.assertEqual(message_box.text(), my_text) self.assertEqual(message_box.informativeText(), inform_text) self.assertEqual(message_box.detailedText(), det_text) utilities.CreateInformativeMessageBox(my_text, "NoIcon", inform_text, det_text, fct_ptr=CheckFct)