Skip to content

Instantly share code, notes, and snippets.

@knzm
Created August 8, 2012 21:30
Show Gist options
  • Select an option

  • Save knzm/3298940 to your computer and use it in GitHub Desktop.

Select an option

Save knzm/3298940 to your computer and use it in GitHub Desktop.
$ python3.2 party.py -v
test_二次会 (__main__.Test参加者) ... skipped ''
test_名刺交換 (__main__.Test参加者) ... ok
test_自己紹介 (__main__.Test参加者) ... ok
----------------------------------------------------------------------
Ran 3 tests in 0.001s
OK (skipped=1)
from unittest import TestCase, SkipTest
class Null名刺入れ:
def get(self):
return None
class 参加者:
def __init__(self):
self._名刺入れ = None
def 自己紹介(self):
pass
def 名刺交換(self, 名刺):
return self.get名刺入れ().get()
def 二次会(self):
raise NotImplementedError
def get名刺入れ(self):
if self._名刺入れ is None:
return Null名刺入れ()
else:
return self._名刺入れ
class Test参加者(TestCase):
def test_自己紹介(self):
参加者().自己紹介()
def test_名刺交換(self):
参加者().名刺交換("名刺")
def test_二次会(self):
raise SkipTest
参加者().二次会()
if __name__ == '__main__':
import unittest
unittest.main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment