示例#1
0
 def type_check(self, arg_name: Text, value: Channel):
     if not isinstance(value, Channel):
         raise TypeError(
             'Argument %s should be a Channel of type_name %r (got %s).' %
             (arg_name, self.type_name, value))
     value.type_check(self.type_name)
示例#2
0
 def testTypeCheckSuccess(self):
     chnl = Channel('MyTypeName')
     chnl.type_check('MyTypeName')
示例#3
0
 def testTypeCheckFail(self):
     chnl = Channel('MyTypeName')
     with self.assertRaises(TypeError):
         chnl.type_check('AnotherTypeName')
示例#4
0
 def test_type_check_success(self):
     chnl = Channel('MyTypeName')
     chnl.type_check('MyTypeName')