Ejemplo n.º 1
0
  def test_and_python(self):
    self.assertTrue(logical.and_(lambda: True, lambda: True))
    self.assertTrue(logical.and_(lambda: [1], lambda: True))
    self.assertListEqual(logical.and_(lambda: True, lambda: [1]), [1])

    self.assertFalse(logical.and_(lambda: False, lambda: True))
    self.assertFalse(logical.and_(lambda: False, self.assertNotCalled))
Ejemplo n.º 2
0
    def test_and_python(self):
        self.assertTrue(logical.and_(lambda: True, lambda: True))
        self.assertTrue(logical.and_(lambda: [1], lambda: True))
        self.assertListEqual(logical.and_(lambda: True, lambda: [1]), [1])

        self.assertFalse(logical.and_(lambda: False, lambda: True))
        self.assertFalse(logical.and_(lambda: False, self.assertNotCalled))
Ejemplo n.º 3
0
 def test_and_tf(self):
   with self.cached_session() as sess:
     t = logical.and_(self._tf_true, self._tf_true)
     self.assertEqual(sess.run(t), True)
     t = logical.and_(self._tf_true, lambda: True)
     self.assertEqual(sess.run(t), True)
     t = logical.and_(self._tf_false, lambda: True)
     self.assertEqual(sess.run(t), False)
Ejemplo n.º 4
0
 def test_and_tf(self):
     with self.cached_session() as sess:
         t = logical.and_(self._tf_true, self._tf_true)
         self.assertEqual(self.evaluate(t), True)
         t = logical.and_(self._tf_true, lambda: True)
         self.assertEqual(self.evaluate(t), True)
         t = logical.and_(self._tf_false, lambda: True)
         self.assertEqual(self.evaluate(t), False)