Python源码示例:syntaxnet.util.check.All()

示例1
def testCheckAll(self):
    check.All([], 'foo')  # empty OK
    check.All([True, 1, [1], 'hello'], 'foo')
    check.All([[[[1]]]], 'foo')
    with self.assertRaisesRegexp(ValueError, 'bar'):
      check.All([None, [1], True], 'bar')
    with self.assertRaisesRegexp(RuntimeError, 'baz'):
      check.All([True, False, True], 'baz', RuntimeError) 
示例2
def testCheckAll(self):
    check.All([], 'foo')  # empty OK
    check.All([True, 1, [1], 'hello'], 'foo')
    check.All([[[[1]]]], 'foo')
    with self.assertRaisesRegexp(ValueError, 'bar'):
      check.All([None, [1], True], 'bar')
    with self.assertRaisesRegexp(RuntimeError, 'baz'):
      check.All([True, False, True], 'baz', RuntimeError) 
示例3
def testCheckAll(self):
    check.All([], 'foo')  # empty OK
    check.All([True, 1, [1], 'hello'], 'foo')
    check.All([[[[1]]]], 'foo')
    with self.assertRaisesRegexp(ValueError, 'bar'):
      check.All([None, [1], True], 'bar')
    with self.assertRaisesRegexp(RuntimeError, 'baz'):
      check.All([True, False, True], 'baz', RuntimeError) 
示例4
def testCheckAll(self):
    check.All([], 'foo')  # empty OK
    check.All([True, 1, [1], 'hello'], 'foo')
    check.All([[[[1]]]], 'foo')
    with self.assertRaisesRegexp(ValueError, 'bar'):
      check.All([None, [1], True], 'bar')
    with self.assertRaisesRegexp(RuntimeError, 'baz'):
      check.All([True, False, True], 'baz', RuntimeError) 
示例5
def testCheckAll(self):
    check.All([], 'foo')  # empty OK
    check.All([True, 1, [1], 'hello'], 'foo')
    check.All([[[[1]]]], 'foo')
    with self.assertRaisesRegexp(ValueError, 'bar'):
      check.All([None, [1], True], 'bar')
    with self.assertRaisesRegexp(RuntimeError, 'baz'):
      check.All([True, False, True], 'baz', RuntimeError) 
示例6
def testCheckAll(self):
    check.All([], 'foo')  # empty OK
    check.All([True, 1, [1], 'hello'], 'foo')
    check.All([[[[1]]]], 'foo')
    with self.assertRaisesRegexp(ValueError, 'bar'):
      check.All([None, [1], True], 'bar')
    with self.assertRaisesRegexp(RuntimeError, 'baz'):
      check.All([True, False, True], 'baz', RuntimeError) 
示例7
def testCheckAll(self):
    check.All([], 'foo')  # empty OK
    check.All([True, 1, [1], 'hello'], 'foo')
    check.All([[[[1]]]], 'foo')
    with self.assertRaisesRegexp(ValueError, 'bar'):
      check.All([None, [1], True], 'bar')
    with self.assertRaisesRegexp(RuntimeError, 'baz'):
      check.All([True, False, True], 'baz', RuntimeError) 
示例8
def testCheckAll(self):
    check.All([], 'foo')  # empty OK
    check.All([True, 1, [1], 'hello'], 'foo')
    check.All([[[[1]]]], 'foo')
    with self.assertRaisesRegexp(ValueError, 'bar'):
      check.All([None, [1], True], 'bar')
    with self.assertRaisesRegexp(RuntimeError, 'baz'):
      check.All([True, False, True], 'baz', RuntimeError) 
示例9
def testCheckAll(self):
    check.All([], 'foo')  # empty OK
    check.All([True, 1, [1], 'hello'], 'foo')
    check.All([[[[1]]]], 'foo')
    with self.assertRaisesRegexp(ValueError, 'bar'):
      check.All([None, [1], True], 'bar')
    with self.assertRaisesRegexp(RuntimeError, 'baz'):
      check.All([True, False, True], 'baz', RuntimeError)