code: def test_and(mock_order_class, mock_exchange_class):
      # Test initialization
      criteria = Limit(limit_price=7000.00) & Timed(duration=5)
      assert criteria
      assert isinstance(criteria, Criteria)
  
      order = mock_order_class.return_value
      order.pair = USD / BTC
      order.created_at = 0
  
      exchange = mock_exchange_class.return_value
  
      # Test (limit=True, timed=True) ===> True
      order.clock.step = 3
  
      order.side = TradeSide.BUY
      exchange.quote_price = mock.Mock(return_value=6800.00)
      assert criteria(order, exchange)
  
      order.side = TradeSide.SELL
      exchange.quote_price = mock.Mock(return_value=7200.00)
      assert criteria(order, exchange)
  
      # Test (limit=True, timed=False) ===> False
      order.clock.step = 8
  
      order.side = TradeSide.BUY
      exchange.quote_price = mock.Mock(return_value=6800.00)
      assert not criteria(order, exchange)
  
      order.side = TradeSide.SELL
      exchange.quote_price = mock.Mock(return_value=7200.00)
      assert not criteria(order, exchange)
  
      # Test (limit=False, timed=True) ===> False
      order.clock.step = 3
  
      order.side = TradeSide.BUY
      exchange.quote_price = mock.Mock(return_value=7200.00)
      assert not criteria(order, exchange)
  
      order.side = TradeSide.SELL
      exchange.quote_price = mock.Mock(return_value=6800.00)
      assert not criteria(order, exchange)
  
      # Test (limit=False, timed=False) ===> False
      order.clock.step = 8
  
      order.side = TradeSide.BUY
      exchange.quote_price = mock.Mock(return_value=7200.00)
      assert not criteria(order, exchange)
  
      order.side = TradeSide.SELL
      exchange.quote_price = mock.Mock(return_value=6800.00)
      assert not criteria(order, exchange)
  
imports: import unittest.mock
  from tensortrade.oms.orders.criteria import Criteria, Limit, Stop, Timed
  from tensortrade.oms.instruments import USD, BTC
  from tensortrade.oms.orders import TradeSide
label_desc: Use image node_id 1 for calling a global function with example usage: test_and(mock_order_class, mock_exchange_class) without return types