You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1021 B

  1. import unittest
  2. from tests.harness import instrumentGooey
  3. from gooey import GooeyParser
  4. from gooey.tests import *
  5. class TestPasswordField(unittest.TestCase):
  6. def makeParser(self, **kwargs):
  7. parser = GooeyParser(description='description')
  8. parser.add_argument('--widget', widget="PasswordField", **kwargs)
  9. return parser
  10. def testPlaceholder(self):
  11. cases = [
  12. [{}, ''],
  13. [{'placeholder': 'Hello'}, 'Hello']
  14. ]
  15. for options, expected in cases:
  16. parser = self.makeParser(gooey_options=options)
  17. with instrumentGooey(parser) as (app, gooeyApp):
  18. # because of how poorly designed the Gooey widgets are
  19. # we have to reach down 3 levels in order to find the
  20. # actual WX object we need to test.
  21. widget = gooeyApp.configs[0].reifiedWidgets[0].widget
  22. self.assertEqual(widget.widget.GetHint(), expected)
  23. if __name__ == '__main__':
  24. unittest.main()