def test_or_python(self):
    self.assertFalse(logical.or_(lambda: False, lambda: False))
    self.assertFalse(logical.or_(lambda: [], lambda: False))
    self.assertListEqual(logical.or_(lambda: False, lambda: [1]), [1])

    self.assertTrue(logical.or_(lambda: False, lambda: True))
    self.assertTrue(logical.or_(lambda: True, self.assertNotCalled))
示例#2
0
    def test_or_python(self):
        self.assertFalse(logical.or_(lambda: False, lambda: False))
        self.assertFalse(logical.or_(lambda: [], lambda: False))
        self.assertListEqual(logical.or_(lambda: False, lambda: [1]), [1])

        self.assertTrue(logical.or_(lambda: False, lambda: True))
        self.assertTrue(logical.or_(lambda: True, self.assertNotCalled))
 def test_or_tf(self):
   with self.cached_session() as sess:
     t = logical.or_(self._tf_false, self._tf_true)
     self.assertEqual(sess.run(t), True)
     t = logical.or_(self._tf_false, lambda: True)
     self.assertEqual(sess.run(t), True)
     t = logical.or_(self._tf_true, lambda: True)
     self.assertEqual(sess.run(t), True)
示例#4
0
 def test_or_tf(self):
     with self.cached_session() as sess:
         t = logical.or_(self._tf_false, self._tf_true)
         self.assertEqual(self.evaluate(t), True)
         t = logical.or_(self._tf_false, lambda: True)
         self.assertEqual(self.evaluate(t), True)
         t = logical.or_(self._tf_true, lambda: True)
         self.assertEqual(self.evaluate(t), True)