コード例 #1
0
 def test_no_completions(self):
     cc = ConsoleCompleter([])
     self.assertIsNone(cc._readline_completer('hello', 0))
コード例 #2
0
 def test_duplicate_case_insensitive(self):
     cc = ConsoleCompleter(['Martha', 'martha', 'mARTHA'])
     self.assertEqual(cc._readline_completer('m', 0), 'Martha')
     self.assertEqual(cc._readline_completer('m', 1), 'martha')
     self.assertEqual(cc._readline_completer('m', 2), 'mARTHA')
     self.assertIsNone(cc._readline_completer('m', 3))
コード例 #3
0
 def test_case_insensitive(self):
     cc = ConsoleCompleter(['Jeff', 'Sean', 'jArED', 'Kathy', 'john'])
     self.assertEqual(cc._readline_completer('J', 0), 'Jeff')
     self.assertEqual(cc._readline_completer('J', 1), 'jArED')
     self.assertEqual(cc._readline_completer('J', 2), 'john')
     self.assertIsNone(cc._readline_completer('J', 3))
コード例 #4
0
 def test_multiple_completion(self):
     cc = ConsoleCompleter(['Ryan', 'Sean', 'Rick', 'Kathy', 'Ron'])
     self.assertEqual(cc._readline_completer('R', 0), 'Ryan')
     self.assertEqual(cc._readline_completer('R', 1), 'Rick')
     self.assertEqual(cc._readline_completer('R', 2), 'Ron')
     self.assertIsNone(cc._readline_completer('R', 3))
コード例 #5
0
 def test_simple_completion(self):
     cc = ConsoleCompleter(['Ryan', 'Sean', 'Kathy'])
     self.assertEqual(cc._readline_completer('R', 0), 'Ryan')
     self.assertIsNone(cc._readline_completer('R', 1))
コード例 #6
0
 def test_no_matches(self):
     cc = ConsoleCompleter(['Ryan', 'Sean', 'Kathy'])
     self.assertIsNone(cc._readline_completer('H', 0))