class TestLibrariesSuggester(_ImportSuggesterTests, unittest.TestCase): def _create_suggester(self, already_imported=(), available=()): self._history_suggester = HistorySuggester() return LibrariesSuggester(self._controller(imports=already_imported, libraries=available), self._history_suggester) @overrides(_ImportSuggesterTests) def test_all_suggestions_with_empty_string(self): self._assert_suggestion_names(['barbar', 'Collections', 'DateTime', 'Dialogs', 'doodoo', 'foobar', 'OperatingSystem', 'Process', 'Remote', 'Screenshot', 'String', 'Telnet', 'XML'], '') def test_history(self): self._assert_suggestion_names([], 'ooz') self._history_suggester.store(u'zooZoo') self._assert_suggestion_names([u'zooZoo'], 'ooz')
class TestLibrariesSuggester(_ImportSuggesterTests, unittest.TestCase): def _create_suggester(self, already_imported=(), available=()): self._history_suggester = HistorySuggester() return LibrariesSuggester(self._controller(imports=already_imported, libraries=available), self._history_suggester) @overrides(_ImportSuggesterTests) def test_all_suggestions_with_empty_string(self): self._assert_suggestion_names(['barbar', 'Collections', 'Dialogs', 'doodoo', 'foobar', 'OperatingSystem', 'Process', 'Remote', 'Screenshot', 'String', 'Telnet', 'XML'], '') def test_history(self): self._assert_suggestion_names([], 'ooz') self._history_suggester.store(u'zooZoo') self._assert_suggestion_names([u'zooZoo'], 'ooz')
def test_history_suggester(self): suggestion_source = HistorySuggester() self.assertEqual([], suggestion_source.get_suggestions('f')) suggestion_source.store('foo') self.assertEqual('foo', suggestion_source.get_suggestions('f')[0].name) self.assertEqual([], suggestion_source.get_suggestions('b')) suggestion_source.store('bar') self.assertEqual('bar', suggestion_source.get_suggestions('b')[0].name) self.assertEqual('foo', suggestion_source.get_suggestions('f')[0].name)
class LibraryDialog(_Dialog): _history_suggester = HistorySuggester() def _get_editors(self, item): name = item and item.name or '' args = item and utils.join_value(item.args) or '' alias = item.alias if item else '' self._suggester = LibrariesSuggester(self._controller, self._history_suggester) return [ FileNameEditor(self, name, 'Name', self._controller, suggestion_source=self._suggester), ValueEditor(self, args, 'Args'), ValueEditor(self, alias, 'Alias') ] def get_value(self): values = _Dialog.get_value(self) self._history_suggester.store(values[0]) return values def _execute(self): pass
class VariablesDialog(LibraryDialog): _history_suggester = HistorySuggester() def _get_editors(self, item): path = item and item.name or '' args = item and utils.join_value(item.args) or '' return [FileNameEditor(self, path, 'Path', self._controller, suggestion_source=self._history_suggester), ValueEditor(self, args, 'Args')]
def _create_suggester(self, already_imported=(), available=()): self._history_suggester = HistorySuggester() return LibrariesSuggester(self._controller(imports=already_imported, libraries=available), self._history_suggester)
def _create_suggester(self, already_imported=(), available=()): self._history_suggester = HistorySuggester() return LibrariesSuggester( self._controller(imports=already_imported, libraries=available), self._history_suggester)