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.

37 lines
1.1 KiB

  1. import argparse
  2. import os
  3. import unittest
  4. from gooey.gui.components.widgets.core import chooser
  5. from gooey.tests import *
  6. class MockWxMDD:
  7. def GetPaths(self):
  8. pass
  9. class TestChooserResults(unittest.TestCase):
  10. def test_multiDirChooserGetResult(self):
  11. expected_outputs = [
  12. (None, "", [""]),
  13. # Windows
  14. ('nt', "C:", ["OS and System (C:)"]),
  15. ('nt', "D:\\A Folder\\Yep Another One",
  16. ["Other Stuff (D:)\\A Folder\\Yep Another One"]),
  17. ('nt', "A:\\Wow Remember Floppy Drives;E:\\Righto Then",
  18. ["Flipflop (A:)\\Wow Remember Floppy Drives",
  19. "Elephants Only (E:)\\Righto Then"])
  20. ]
  21. for osname, expected, pathsoutput in expected_outputs:
  22. if not osname or osname == os.name:
  23. chooser.MDD.MultiDirDialog = MockWxMDD
  24. chooser.MDD.MultiDirDialog.GetPaths = lambda self : pathsoutput
  25. result = chooser.MultiDirChooser.getResult(None, MockWxMDD())
  26. print(result)
  27. self.assertEqual(result, expected)
  28. if __name__ == '__main__':
  29. unittest.main()