mirror of
https://github.com/python/cpython.git
synced 2025-07-29 14:15:07 +00:00
Added bytes and b'' as aliases for str and ''
This commit is contained in:
parent
a9e073d100
commit
288e89acfc
6 changed files with 43 additions and 4 deletions
|
@ -106,8 +106,19 @@ class ModuleTest(unittest.TestCase):
|
|||
self.assertEqual(string.capwords('ABC-DEF-GHI', '-'), 'Abc-Def-Ghi')
|
||||
self.assertEqual(string.capwords('ABC-def DEF-ghi GHI'), 'Abc-def Def-ghi Ghi')
|
||||
|
||||
class BytesAliasTest(unittest.TestCase):
|
||||
|
||||
def test_builtin(self):
|
||||
self.assert_(str is bytes)
|
||||
|
||||
def test_syntax(self):
|
||||
self.assertEqual(b"spam", "spam")
|
||||
self.assertEqual(br"egg\foo", "egg\\foo")
|
||||
self.assert_(type(b""), str)
|
||||
self.assert_(type(br""), str)
|
||||
|
||||
def test_main():
|
||||
test_support.run_unittest(StringTest, ModuleTest)
|
||||
test_support.run_unittest(StringTest, ModuleTest, BytesAliasTest)
|
||||
|
||||
if __name__ == "__main__":
|
||||
test_main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue