0

def show(a):
    """ Shows a string

>>> show(a)
a

"""
    print(a)

def test():
    import doctest
    doctest.testmod()

if __name__ == '__main__': test()

docstring の仕組みを学習しようとしているときにエラーが発生しました。この方法とコマンドラインからの実行の両方

python -m doctest unittest.py

エラーで終了します。

Traceback (most recent call last):
  File "/home/liquid/workspace/MyPythonProject/src/unittest.py", line 19, in <module>
    if __name__ == '__main__': test()
  File "/home/liquid/workspace/MyPythonProject/src/unittest.py", line 16, in test
    import doctest
  File "/usr/lib/python3.2/doctest.py", line 2105, in <module>
    class DocTestCase(unittest.TestCase):
AttributeError: 'module' object has no attribute 'TestCase'

なんで?

4

1 に答える 1