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


Python factory.Sequence方法代码示例

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


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

示例1: UssdSessionFactory

# 需要导入模块: import factory [as 别名]
# 或者: from factory import Sequence [as 别名]
def UssdSessionFactory(**kwargs):
    # Uses Class Naming Convention because it's actually a delayed execution Class
    def inner():
        unique_name = Sequence(lambda n: f'FooSSD{n}')
        ussd_menu = UssdMenuFactory(name=unique_name, display_key=unique_name)

        return UssdSessionFactoryBase(ussd_menu=ussd_menu, **kwargs)

    return inner() 
开发者ID:teamsempo,项目名称:SempoBlockchain,代码行数:11,代码来源:model_factories.py

示例2: Tweet

# 需要导入模块: import factory [as 别名]
# 或者: from factory import Sequence [as 别名]
def Tweet(session):
    class _TweetFactory(factory.Factory):
        class Meta:
            model = model

        id = factory.Sequence(lambda n: n)

    return _TweetFactory 
开发者ID:busy-beaver-dev,项目名称:busy-beaver,代码行数:10,代码来源:tweet.py

示例3: two_pages_of_invoices

# 需要导入模块: import factory [as 别名]
# 或者: from factory import Sequence [as 别名]
def two_pages_of_invoices(db, settings):
    allowed_states = [Invoice.STATES.ISSUED, Invoice.STATES.PAID, Invoice.STATES.CANCELED]
    return InvoiceFactory.create_batch(
        settings.API_PAGE_SIZE * 2,
        state=factory.Sequence(
            lambda n: allowed_states[n % len(allowed_states)]
        )
    ) 
开发者ID:silverapp,项目名称:silver,代码行数:10,代码来源:pytest_fixtures.py

示例4: create_branch_by_slots

# 需要导入模块: import factory [as 别名]
# 或者: from factory import Sequence [as 别名]
def create_branch_by_slots(
        cls, slots: Sequence[Slot], root: BaseSignedBeaconBlock = None, **kwargs: Any
    ) -> Iterable[BaseSignedBeaconBlock]:
        if root is None:
            root = cls()

        parent = cls(
            message__parent_root=root.message.hash_tree_root, message__slot=slots[0], **kwargs
        )
        yield parent
        for slot in slots[1:]:
            child = cls(message__parent_root=parent.message.hash_tree_root, message__slot=slot)
            yield child
            parent = child 
开发者ID:ethereum,项目名称:trinity,代码行数:16,代码来源:bcc_factories.py


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