bpo-40529: rlcompleter with case insensitive

Changed func name set_case_insensitive() -> set_ignore_case()
Modified Docs and Tests accordingly

* skip news
This commit is contained in:
Madhusudhan Kasula 2020-06-10 18:38:00 +05:30
parent 7a58345743
commit 6a1f3d0cf7
3 changed files with 5 additions and 5 deletions

View File

@ -69,7 +69,7 @@ Case Sensitivity
You can change the Completer's default case sensitive selection to case insensitive using the following method: You can change the Completer's default case sensitive selection to case insensitive using the following method:
.. function:: rlcompleter.set_case_insensitive(option) .. function:: rlcompleter.set_ignore_case(option)
Return the *None*. Return the *None*.

View File

@ -13,7 +13,7 @@ Tip: to use the tab key as the completion key, call
And to make completion with case insensitive, call And to make completion with case insensitive, call
rlcompleter.set_case_insensitive(True) rlcompleter.set_ignore_case(True)
Notes: Notes:
@ -192,7 +192,7 @@ class Completer:
return matches return matches
_re_ignorecase_flags = 0 _re_ignorecase_flags = 0
def set_case_insensitive(option): def set_ignore_case(option):
import re import re
global _re_ignorecase_flags global _re_ignorecase_flags
_re_ignorecase_flags = re.IGNORECASE if option else 0 _re_ignorecase_flags = re.IGNORECASE if option else 0

View File

@ -141,7 +141,7 @@ class TestRlcompleter(unittest.TestCase):
# add an additional attr for testing # add an additional attr for testing
CompleteMe.SpAm = 2 CompleteMe.SpAm = 2
# enable the case insensitive option # enable the case insensitive option
rlcompleter.set_case_insensitive(True) rlcompleter.set_ignore_case(True)
# test globals # test globals
self.assertEqual(self.completer.global_matches('completem'), self.assertEqual(self.completer.global_matches('completem'),
['CompleteMe(']) ['CompleteMe('])
@ -149,7 +149,7 @@ class TestRlcompleter(unittest.TestCase):
self.assertNotEqual(self.completer.attr_matches('CompleteMe.spa'), self.assertNotEqual(self.completer.attr_matches('CompleteMe.spa'),
['CompleteMe.spam', 'CompleteMe.SpAm']) ['CompleteMe.spam', 'CompleteMe.SpAm'])
# disable the case insensitive option # disable the case insensitive option
rlcompleter.set_case_insensitive(False) rlcompleter.set_ignore_case(False)
# test globals # test globals
self.assertNotEqual(self.completer.global_matches('completem'), self.assertNotEqual(self.completer.global_matches('completem'),
['CompleteMe(']) ['CompleteMe('])