当前位置: 首页>>代码示例>>Python>>正文


Python Dao.get_all_regions方法代码示例

本文整理汇总了Python中dao.Dao.get_all_regions方法的典型用法代码示例。如果您正苦于以下问题:Python Dao.get_all_regions方法的具体用法?Python Dao.get_all_regions怎么用?Python Dao.get_all_regions使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在dao.Dao的用法示例。


在下文中一共展示了Dao.get_all_regions方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_init_with_invalid_region

# 需要导入模块: from dao import Dao [as 别名]
# 或者: from dao.Dao import get_all_regions [as 别名]
    def test_init_with_invalid_region(self):
        print Dao.get_all_regions(mongo_client=self.mongo_client)
        # create a dao with an existing region
        Dao(self.region, mongo_client=self.mongo_client, new=False)

        # create a dao with a new region
        with self.assertRaises(RegionNotFoundException):
            Dao('newregion', mongo_client=self.mongo_client, new=False)
开发者ID:novacourtois,项目名称:garpr,代码行数:10,代码来源:test_dao.py

示例2: get

# 需要导入模块: from dao import Dao [as 别名]
# 或者: from dao.Dao import get_all_regions [as 别名]
    def get(self):
        regions_dict = {'regions': [r.get_json_dict() for r in Dao.get_all_regions(mongo_client)]}

        for region in regions_dict['regions']:
            region['id'] = region['_id']
            del region['_id']

        return regions_dict
开发者ID:acoulon99,项目名称:garpr,代码行数:10,代码来源:server.py

示例3: test_get_all_regions

# 需要导入模块: from dao import Dao [as 别名]
# 或者: from dao.Dao import get_all_regions [as 别名]
    def test_get_all_regions(self):
        # add another region
        region = Region('newregion', 'New Region')
        Dao.insert_region(region, self.mongo_client, database_name=DATABASE_NAME)

        regions = Dao.get_all_regions(self.mongo_client, database_name=DATABASE_NAME)
        self.assertEquals(len(regions), 3)
        self.assertEquals(regions[0], region)
        self.assertEquals(regions[1], self.region_1)
        self.assertEquals(regions[2], self.region_2)
开发者ID:MrMonacle,项目名称:garpr,代码行数:12,代码来源:test_dao.py

示例4: test_get_all_regions

# 需要导入模块: from dao import Dao [as 别名]
# 或者: from dao.Dao import get_all_regions [as 别名]
    def test_get_all_regions(self):
        # add another region
        region = 'newregion'
        Dao(region, mongo_client=self.mongo_client, new=True)

        self.assertEquals(set(Dao.get_all_regions(mongo_client=self.mongo_client)), set([self.region, region]))
开发者ID:novacourtois,项目名称:garpr,代码行数:8,代码来源:test_dao.py

示例5: ChallongeScraper

# 需要导入模块: from dao import Dao [as 别名]
# 或者: from dao.Dao import get_all_regions [as 别名]
import unittest
from dao import Dao, RegionNotFoundException, DuplicateAliasException, InvalidNameException
from bson.objectid import ObjectId
from model import *
from ming import mim
import trueskill
from datetime import datetime
from pymongo.errors import DuplicateKeyError
from pymongo import MongoClient
import scraper.challonge
from scraper.challonge import ChallongeScraper

DATABASE_NAME = 'data'
PLAYERS_COLLECTION_NAME = 'players'
TOURNAMENTS_COLLECTION_NAME = 'tournaments'
RANKINGS_COLLECTION_NAME = 'rankings'
REGIONS_COLLECTION_NAME = 'regions'
USERS_COLLECTION_NAME = 'users'

TEST_TOURNEY = 983062

scraper = ChallongeScraper(TEST_TOURNEY)

mongo_client = MongoClient()
region = Region(7,'New Zealand')
##Dao.insert_region(region, mongo_client) 
p = Dao.get_all_regions(mongo_client)
mongo_client.close()
开发者ID:AJAnderson,项目名称:garpr,代码行数:30,代码来源:preparelocaldb.py

示例6: get

# 需要导入模块: from dao import Dao [as 别名]
# 或者: from dao.Dao import get_all_regions [as 别名]
    def get(self):
        regions_dict = {'regions': [
            r.dump(context='web') for r in Dao.get_all_regions(mongo_client)]}

        return regions_dict
开发者ID:jiangtyd,项目名称:smash-ranks,代码行数:7,代码来源:server.py


注:本文中的dao.Dao.get_all_regions方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。