本文整理汇总了Python中models.Stock.find方法的典型用法代码示例。如果您正苦于以下问题:Python Stock.find方法的具体用法?Python Stock.find怎么用?Python Stock.find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Stock
的用法示例。
在下文中一共展示了Stock.find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_fuzzy_text_search_industry_name
# 需要导入模块: from models import Stock [as 别名]
# 或者: from models.Stock import find [as 别名]
def test_fuzzy_text_search_industry_name(self):
stocks = Stock.find({'industry': 'consumer'}, test_mode=True)
stock = stocks[0]
self._assert_first_stock(stock)
stock_2 = stocks[1]
self._assert_second_stock(stock_2)
示例2: get_all_stocks
# 需要导入模块: from models import Stock [as 别名]
# 或者: from models.Stock import find [as 别名]
def get_all_stocks(name=None):
search_name = request.args.get('name')
if search_name:
stock = Stock.find_one({'name': search_name}, test_mode=app.testing)
return jsonify(stock=stock)
industry = request.args.get('industry')
if industry:
stocks = Stock.find({'industry': industry}, test_mode=app.testing)
return jsonify(stocks=stocks)
# Get all stocks
stocks = Stock.find_all(test_mode=app.testing)
return jsonify(stocks=stocks['stocks'])
示例3: test_find_allstocks_by_industry_name
# 需要导入模块: from models import Stock [as 别名]
# 或者: from models.Stock import find [as 别名]
def test_find_allstocks_by_industry_name(self):
stocks = Stock.find({'industry': 'Consumer Products'}, test_mode=True)
stock = stocks[0]
self._assert_first_stock(stock)