Skip to content

Instantly share code, notes, and snippets.

@DecKen
Created October 31, 2014 16:32
Show Gist options
  • Save DecKen/244bc259abcbf973b1af to your computer and use it in GitHub Desktop.
Save DecKen/244bc259abcbf973b1af to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding:utf-8 -*-
def test(string):
u"""
>>> test(u"Hello")
u'Hello'
>>> test(u"你好")
u"你好"
"""
return string
if __name__ == '__main__':
import doctest
doctest.testmod()
错误提示:
**********************************************************************
File "C:/Projects/Python/tutorial/test.py", line 10, in __main__.test
Failed example:
test(u"你好")
Expected:
u"你好"
Got:
u'\u4f60\u597d'
**********************************************************************
1 items had failures:
1 of 2 in __main__.test
***Test Failed*** 1 failures.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment