コード例 #1
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_repr__not_captured(self):
     captor = __unit__.Captor()
     self.assertNotIn("(*)", repr(captor))
コード例 #2
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_repr__captured(self):
     captor = __unit__.Captor()
     captor.match(self.ARG)
     self.assertIn("(*)", repr(captor))
コード例 #3
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_match___not_captured(self):
     captor = __unit__.Captor(self.FALSE_MATCHER)
     self.assertFalse(captor.match(self.ARG))
コード例 #4
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_match__double_capture(self):
     captor = __unit__.Captor()
     captor.match(self.ARG)
     with self.assertRaisesRegexp(ValueError, r'already'):
         captor.match(self.ARG)
コード例 #5
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_arg__captured(self):
     captor = __unit__.Captor()
     captor.match(self.ARG)
     self.assertIs(self.ARG, captor.arg)
コード例 #6
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_match__captured(self):
     captor = __unit__.Captor()
     self.assertTrue(captor.match(self.ARG))
コード例 #7
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_arg__initial(self):
     captor = __unit__.Captor()
     with self.assertRaisesRegexp(ValueError, r'no value'):
         captor.arg
コード例 #8
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_arg__not_captured(self):
     # When the argument fails the matcher test, it should not be captured.
     captor = __unit__.Captor(self.FALSE_MATCHER)
     captor.match(self.ARG)
     with self.assertRaisesRegexp(ValueError, r'no value'):
         captor.arg
コード例 #9
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_has_value__not_captured(self):
     # When the argument fails the matcher test, it should not be captured.
     captor = __unit__.Captor(self.FALSE_MATCHER)
     captor.match(self.ARG)
     self.assertFalse(captor.has_value())
コード例 #10
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_has_value__captured(self):
     captor = __unit__.Captor()
     captor.match(self.ARG)
     self.assertTrue(captor.has_value())
コード例 #11
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_has_value__initial(self):
     captor = __unit__.Captor()
     self.assertFalse(captor.has_value())
コード例 #12
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_ctor__captor(self):
     captor = __unit__.Captor()
     with self.assertRaisesRegexp(TypeError, r'captor'):
         __unit__.Captor(captor)
コード例 #13
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_ctor__matcher(self):
     matcher = __unit__.Matching(bool)
     captor = __unit__.Captor(matcher)
     self.assertIs(matcher, captor.matcher)
コード例 #14
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_ctor__invalid_matcher(self):
     not_matcher = object()
     with self.assertRaisesRegexp(TypeError, r'expected'):
         __unit__.Captor(not_matcher)
コード例 #15
0
ファイル: test_general.py プロジェクト: tirkarthi/callee
 def test_ctor__no_args(self):
     captor = __unit__.Captor()
     self.assertIsInstance(captor.matcher, __unit__.Any)