コード例 #1
0
def test_iterator_to_list():
  """Test the iterator_to_list function."""
  my_set = OrderedSet()
  my_set.append(1)
  my_set.append(2)
  my_set.append(3)
  expected = [1, 2, 3]
  my_list = iterator_to_list(my_set)
  assert_equal(type(my_list), type(expected), 'Expected the result to be a list.')
  assert_equal(my_list, expected)
コード例 #2
0
ファイル: backtest.py プロジェクト: adamcataldo/djscrooge
 def get_positions(self, symbol):
   """Gets the open positions for the given symbol.
   
   The returned object is a list of OpenPosition objects. Do not modify this list directly. 
   Instead call add_position or remove_position. The returned object is not the same as
   the internally stored values. This is done for efficiency reasons. You can modify 
   elements of the list, however, to update the cost basis or remaining shares of the 
   underlying OpenPosition.
   """
   return iterator_to_list(self.__positions[symbol])