Python源码示例:syntaxnet.util.check.Is()
示例1
def testCheckIs(self):
check.Is(1, 1, 'foo')
check.Is(None, None, 'foo')
with self.assertRaisesRegexp(ValueError, 'bar'):
check.Is(1, None, 'bar')
with self.assertRaisesRegexp(RuntimeError, 'baz'):
check.Is(1, -1, 'baz', RuntimeError)
示例2
def testCheckIs(self):
check.Is(1, 1, 'foo')
check.Is(None, None, 'foo')
with self.assertRaisesRegexp(ValueError, 'bar'):
check.Is(1, None, 'bar')
with self.assertRaisesRegexp(RuntimeError, 'baz'):
check.Is(1, -1, 'baz', RuntimeError)
示例3
def testCheckIs(self):
check.Is(1, 1, 'foo')
check.Is(None, None, 'foo')
with self.assertRaisesRegexp(ValueError, 'bar'):
check.Is(1, None, 'bar')
with self.assertRaisesRegexp(RuntimeError, 'baz'):
check.Is(1, -1, 'baz', RuntimeError)
示例4
def testCheckIs(self):
check.Is(1, 1, 'foo')
check.Is(None, None, 'foo')
with self.assertRaisesRegexp(ValueError, 'bar'):
check.Is(1, None, 'bar')
with self.assertRaisesRegexp(RuntimeError, 'baz'):
check.Is(1, -1, 'baz', RuntimeError)
示例5
def testCheckIs(self):
check.Is(1, 1, 'foo')
check.Is(None, None, 'foo')
with self.assertRaisesRegexp(ValueError, 'bar'):
check.Is(1, None, 'bar')
with self.assertRaisesRegexp(RuntimeError, 'baz'):
check.Is(1, -1, 'baz', RuntimeError)
示例6
def testCheckIs(self):
check.Is(1, 1, 'foo')
check.Is(None, None, 'foo')
with self.assertRaisesRegexp(ValueError, 'bar'):
check.Is(1, None, 'bar')
with self.assertRaisesRegexp(RuntimeError, 'baz'):
check.Is(1, -1, 'baz', RuntimeError)
示例7
def testCheckIs(self):
check.Is(1, 1, 'foo')
check.Is(None, None, 'foo')
with self.assertRaisesRegexp(ValueError, 'bar'):
check.Is(1, None, 'bar')
with self.assertRaisesRegexp(RuntimeError, 'baz'):
check.Is(1, -1, 'baz', RuntimeError)
示例8
def testCheckIs(self):
check.Is(1, 1, 'foo')
check.Is(None, None, 'foo')
with self.assertRaisesRegexp(ValueError, 'bar'):
check.Is(1, None, 'bar')
with self.assertRaisesRegexp(RuntimeError, 'baz'):
check.Is(1, -1, 'baz', RuntimeError)
示例9
def testCheckIs(self):
check.Is(1, 1, 'foo')
check.Is(None, None, 'foo')
with self.assertRaisesRegexp(ValueError, 'bar'):
check.Is(1, None, 'bar')
with self.assertRaisesRegexp(RuntimeError, 'baz'):
check.Is(1, -1, 'baz', RuntimeError)