Python UserString.MutableString() Examples
The following are 23
code examples of UserString.MutableString().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
UserString
, or try the search function
.
Example #1
Source File: test_userstring.py From ironpython2 with Apache License 2.0 | 6 votes |
def test_extended_set_del_slice(self): indices = (0, None, 1, 3, 19, 100, -1, -2, -31, -100) orig = string.ascii_letters + string.digits for start in indices: for stop in indices: # Use indices[1:] when MutableString can handle real # extended slices for step in (None, 1, -1): s = self.type2test(orig) L = list(orig) # Make sure we have a slice of exactly the right length, # but with (hopefully) different data. data = L[start:stop:step] data.reverse() L[start:stop:step] = data s[start:stop:step] = "".join(data) self.assertEqual(s, "".join(L)) del L[start:stop:step] del s[start:stop:step] self.assertEqual(s, "".join(L))
Example #2
Source File: test_userstring.py From CTFCrackTools with GNU General Public License v3.0 | 6 votes |
def test_extended_set_del_slice(self): indices = (0, None, 1, 3, 19, 100, -1, -2, -31, -100) orig = string.ascii_letters + string.digits for start in indices: for stop in indices: # Use indices[1:] when MutableString can handle real # extended slices for step in (None, 1, -1): s = self.type2test(orig) L = list(orig) # Make sure we have a slice of exactly the right length, # but with (hopefully) different data. data = L[start:stop:step] data.reverse() L[start:stop:step] = data s[start:stop:step] = "".join(data) self.assertEqual(s, "".join(L)) del L[start:stop:step] del s[start:stop:step] self.assertEqual(s, "".join(L))
Example #3
Source File: test_userstring.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
def test_extended_set_del_slice(self): indices = (0, None, 1, 3, 19, 100, -1, -2, -31, -100) orig = string.ascii_letters + string.digits for start in indices: for stop in indices: # Use indices[1:] when MutableString can handle real # extended slices for step in (None, 1, -1): s = self.type2test(orig) L = list(orig) # Make sure we have a slice of exactly the right length, # but with (hopefully) different data. data = L[start:stop:step] data.reverse() L[start:stop:step] = data s[start:stop:step] = "".join(data) self.assertEqual(s, "".join(L)) del L[start:stop:step] del s[start:stop:step] self.assertEqual(s, "".join(L))
Example #4
Source File: test_userstring.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
def test_extended_set_del_slice(self): indices = (0, None, 1, 3, 19, 100, -1, -2, -31, -100) orig = string.ascii_letters + string.digits for start in indices: for stop in indices: # Use indices[1:] when MutableString can handle real # extended slices for step in (None, 1, -1): s = self.type2test(orig) L = list(orig) # Make sure we have a slice of exactly the right length, # but with (hopefully) different data. data = L[start:stop:step] data.reverse() L[start:stop:step] = data s[start:stop:step] = "".join(data) self.assertEqual(s, "".join(L)) del L[start:stop:step] del s[start:stop:step] self.assertEqual(s, "".join(L))
Example #5
Source File: test_userstring.py From oss-ftp with MIT License | 6 votes |
def test_extended_set_del_slice(self): indices = (0, None, 1, 3, 19, 100, -1, -2, -31, -100) orig = string.ascii_letters + string.digits for start in indices: for stop in indices: # Use indices[1:] when MutableString can handle real # extended slices for step in (None, 1, -1): s = self.type2test(orig) L = list(orig) # Make sure we have a slice of exactly the right length, # but with (hopefully) different data. data = L[start:stop:step] data.reverse() L[start:stop:step] = data s[start:stop:step] = "".join(data) self.assertEqual(s, "".join(L)) del L[start:stop:step] del s[start:stop:step] self.assertEqual(s, "".join(L))
Example #6
Source File: test_userstring.py From BinderFilter with MIT License | 6 votes |
def test_extended_set_del_slice(self): indices = (0, None, 1, 3, 19, 100, -1, -2, -31, -100) orig = string.ascii_letters + string.digits for start in indices: for stop in indices: # Use indices[1:] when MutableString can handle real # extended slices for step in (None, 1, -1): s = self.type2test(orig) L = list(orig) # Make sure we have a slice of exactly the right length, # but with (hopefully) different data. data = L[start:stop:step] data.reverse() L[start:stop:step] = data s[start:stop:step] = "".join(data) self.assertEqual(s, "".join(L)) del L[start:stop:step] del s[start:stop:step] self.assertEqual(s, "".join(L))
Example #7
Source File: demjson.py From ru with GNU General Public License v2.0 | 5 votes |
def isstringtype( obj ): """Is the object of a Python string type?""" if isinstance(obj, basestring): return True # Must also check for some other pseudo-string types import types, UserString return isinstance(obj, types.StringTypes) \ or isinstance(obj, UserString.UserString) \ or isinstance(obj, UserString.MutableString) # ---------------------------------------------------------------------- # Numeric helpers
Example #8
Source File: test_userstring.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_main(): with warnings.catch_warnings(): warnings.filterwarnings("ignore", ".*MutableString has been removed", DeprecationWarning) warnings.filterwarnings("ignore", ".*__(get|set|del)slice__ has been removed", DeprecationWarning) test_support.run_unittest(UserStringTest, MutableStringTest)
Example #9
Source File: test_py3kwarn.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_mutablestring_removal(self): # UserString.MutableString has been removed in 3.0. import UserString # UserString tests may have already triggered this warning reset_module_registry(UserString) with warnings.catch_warnings(): warnings.filterwarnings("error", ".*MutableString", DeprecationWarning) self.assertRaises(DeprecationWarning, UserString.MutableString)
Example #10
Source File: test_py3kwarn.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def test_mutablestring_removal(self): # UserString.MutableString has been removed in 3.0. import UserString # UserString tests may have already triggered this warning reset_module_registry(UserString) with warnings.catch_warnings(): warnings.filterwarnings("error", ".*MutableString", DeprecationWarning) self.assertRaises(DeprecationWarning, UserString.MutableString)
Example #11
Source File: test_userstring.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_main(): with warnings.catch_warnings(): warnings.filterwarnings("ignore", ".*MutableString has been removed", DeprecationWarning) warnings.filterwarnings("ignore", ".*__(get|set|del)slice__ has been removed", DeprecationWarning) test_support.run_unittest(UserStringTest, MutableStringTest)
Example #12
Source File: test_userstring.py From ironpython2 with Apache License 2.0 | 5 votes |
def test_main(): with warnings.catch_warnings(): warnings.filterwarnings("ignore", ".*MutableString has been removed", DeprecationWarning) warnings.filterwarnings("ignore", ".*__(get|set|del)slice__ has been removed", DeprecationWarning) test_support.run_unittest(UserStringTest, MutableStringTest)
Example #13
Source File: test_py3kwarn.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def test_mutablestring_removal(self): # UserString.MutableString has been removed in 3.0. import UserString # UserString tests may have already triggered this warning reset_module_registry(UserString) with warnings.catch_warnings(): warnings.filterwarnings("error", ".*MutableString", DeprecationWarning) self.assertRaises(DeprecationWarning, UserString.MutableString)
Example #14
Source File: demjson3.py From ru with GNU General Public License v2.0 | 5 votes |
def isstringtype( obj ): """Is the object of a Python string type?""" if isinstance(obj, basestring): return True # Must also check for some other pseudo-string types import types, UserString return isinstance(obj, types.StringTypes) \ or isinstance(obj, UserString.UserString) \ or isinstance(obj, UserString.MutableString) # ---------------------------------------------------------------------- # Numeric helpers
Example #15
Source File: demjson3.py From ru with GNU General Public License v2.0 | 5 votes |
def isstringtype( obj ): """Is the object of a Python string type?""" if isinstance(obj, basestring): return True # Must also check for some other pseudo-string types import types, UserString return isinstance(obj, types.StringTypes) \ or isinstance(obj, UserString.UserString) \ or isinstance(obj, UserString.MutableString) # ---------------------------------------------------------------------- # Numeric helpers
Example #16
Source File: test_userstring.py From BinderFilter with MIT License | 5 votes |
def test_main(): with warnings.catch_warnings(): warnings.filterwarnings("ignore", ".*MutableString has been removed", DeprecationWarning) warnings.filterwarnings("ignore", ".*__(get|set|del)slice__ has been removed", DeprecationWarning) test_support.run_unittest(UserStringTest, MutableStringTest)
Example #17
Source File: demjson3.py From ru with GNU General Public License v2.0 | 5 votes |
def isstringtype( obj ): """Is the object of a Python string type?""" if isinstance(obj, basestring): return True # Must also check for some other pseudo-string types import types, UserString return isinstance(obj, types.StringTypes) \ or isinstance(obj, UserString.UserString) \ or isinstance(obj, UserString.MutableString) # ---------------------------------------------------------------------- # Numeric helpers
Example #18
Source File: test_userstring.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_main(): with warnings.catch_warnings(): warnings.filterwarnings("ignore", ".*MutableString has been removed", DeprecationWarning) warnings.filterwarnings("ignore", ".*__(get|set|del)slice__ has been removed", DeprecationWarning) test_support.run_unittest(UserStringTest, MutableStringTest)
Example #19
Source File: test_py3kwarn.py From BinderFilter with MIT License | 5 votes |
def test_mutablestring_removal(self): # UserString.MutableString has been removed in 3.0. import UserString # UserString tests may have already triggered this warning reset_module_registry(UserString) with warnings.catch_warnings(): warnings.filterwarnings("error", ".*MutableString", DeprecationWarning) self.assertRaises(DeprecationWarning, UserString.MutableString)
Example #20
Source File: test_py3kwarn.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def test_mutablestring_removal(self): # UserString.MutableString has been removed in 3.0. import UserString # UserString tests may have already triggered this warning reset_module_registry(UserString) with warnings.catch_warnings(): warnings.filterwarnings("error", ".*MutableString", DeprecationWarning) self.assertRaises(DeprecationWarning, UserString.MutableString)
Example #21
Source File: demjson.py From Quillpad-Server with BSD 3-Clause "New" or "Revised" License | 5 votes |
def isstringtype( obj ): """Is the object of a Python string type?""" if isinstance(obj, basestring): return True # Must also check for some other pseudo-string types import types, UserString return isinstance(obj, types.StringTypes) \ or isinstance(obj, UserString.UserString) \ or isinstance(obj, UserString.MutableString) # ---------------------------------------------------------------------- # Numeric helpers
Example #22
Source File: test_userstring.py From oss-ftp with MIT License | 5 votes |
def test_main(): with warnings.catch_warnings(): warnings.filterwarnings("ignore", ".*MutableString has been removed", DeprecationWarning) warnings.filterwarnings("ignore", ".*__(get|set|del)slice__ has been removed", DeprecationWarning) test_support.run_unittest(UserStringTest, MutableStringTest)
Example #23
Source File: test_py3kwarn.py From oss-ftp with MIT License | 5 votes |
def test_mutablestring_removal(self): # UserString.MutableString has been removed in 3.0. import UserString # UserString tests may have already triggered this warning reset_module_registry(UserString) with warnings.catch_warnings(): warnings.filterwarnings("error", ".*MutableString", DeprecationWarning) self.assertRaises(DeprecationWarning, UserString.MutableString)