diff options
author | Christian Heimes <christian@cheimes.de> | 2008-01-18 18:24:07 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2008-01-18 18:24:07 (GMT) |
commit | 288e89acfc29cf857a8c5d314ba2dd3398a2eae9 (patch) | |
tree | e4ca8e317d378207d274157a0dc138e2917cbc1b /Lib/test | |
parent | a9e073d100c3869231ce7275ff7a810d8db74fc4 (diff) | |
download | cpython-288e89acfc29cf857a8c5d314ba2dd3398a2eae9.zip cpython-288e89acfc29cf857a8c5d314ba2dd3398a2eae9.tar.gz cpython-288e89acfc29cf857a8c5d314ba2dd3398a2eae9.tar.bz2 |
Added bytes and b'' as aliases for str and ''
Diffstat (limited to 'Lib/test')
-rw-r--r-- | Lib/test/test_string.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/Lib/test/test_string.py b/Lib/test/test_string.py index fdd431d..9b22333 100644 --- a/Lib/test/test_string.py +++ b/Lib/test/test_string.py @@ -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() |