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


Python CategoryFactory.create_batch方法代码示例

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


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

示例1: test_filter_categories_by_one_condition

# 需要导入模块: from factories import CategoryFactory [as 别名]
# 或者: from factories.CategoryFactory import create_batch [as 别名]
    def test_filter_categories_by_one_condition(self):
        """Test filter_categories_by returns a list of categories that meet
        the filtering condition"""

        CategoryFactory.create_batch(3, description='generic category')
        should_be_missing = CategoryFactory.create(description='other category')

        retrieved_categories = (self.project_repo
            .filter_categories_by(description='generic category'))

        assert len(retrieved_categories) == 3, retrieved_categories
        assert should_be_missing not in retrieved_categories, retrieved_categories
开发者ID:anukat2015,项目名称:pybossa,代码行数:14,代码来源:test_project_repository.py

示例2: test_filter_categories_by_limit_offset

# 需要导入模块: from factories import CategoryFactory [as 别名]
# 或者: from factories.CategoryFactory import create_batch [as 别名]
    def test_filter_categories_by_limit_offset(self):
        """Test that filter_categories_by supports limit and offset options"""

        CategoryFactory.create_batch(4)
        all_categories = self.project_repo.filter_categories_by()

        first_two = self.project_repo.filter_categories_by(limit=2)
        last_two = self.project_repo.filter_categories_by(limit=2, offset=2)

        assert len(first_two) == 2, first_two
        assert len(last_two) == 2, last_two
        assert first_two == all_categories[:2]
        assert last_two == all_categories[2:]
开发者ID:anukat2015,项目名称:pybossa,代码行数:15,代码来源:test_project_repository.py

示例3: get_all_returns_list_of_all_categories

# 需要导入模块: from factories import CategoryFactory [as 别名]
# 或者: from factories.CategoryFactory import create_batch [as 别名]
    def get_all_returns_list_of_all_categories(self):
        """Test get_all_categories returns a list of all the existing categories"""

        categories = CategoryFactory.create_batch(3)

        retrieved_categories = self.project_repo.get_all_categories()

        assert isinstance(retrieved_categories, list)
        assert len(retrieved_categories) == len(categories), retrieved_categories
        for category in retrieved_categories:
            assert category in categories, category
开发者ID:anukat2015,项目名称:pybossa,代码行数:13,代码来源:test_project_repository.py


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