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


Python Project.pathname方法代码示例

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


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

示例1: test_self_destruct_1

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import pathname [as 别名]
def test_self_destruct_1():
    """
    Delete an entity.
    """

    p = Project()
    p.pathname = '/tmp'
    e1 = Entity(p, title="e1", a=1, b=2)
    file_written = e1.to_yaml_file(p.pathname)

    files_deleted = e1.self_destruct(p)

    assert files_deleted == [file_written]
    assert not os.path.exists(file_written)
开发者ID:gitmob,项目名称:pitz,代码行数:16,代码来源:test_entity.py

示例2: test_self_destruct_2

# 需要导入模块: from pitz.project import Project [as 别名]
# 或者: from pitz.project.Project import pathname [as 别名]
def test_self_destruct_2():
    """
    Delete an entity with activities and verify activities are gone too.
    """

    p = Project()
    p.pathname = '/tmp'
    p.current_user = Person(p, title="matt")

    e1 = Entity(p, title="entity for test_self_destruct_2", a=1, b=2)
    file_written = e1.to_yaml_file(p.pathname)

    print("file_written is %s" % file_written)

    c = e1.comment(who_said_it="matt", title="blah", description="")
    comment_yaml_file = c.to_yaml_file(p.pathname)

    # Update an attribute (to generate an activity).
    e1.record_activity_on_changes = True
    e1['a'] = 11

    assert e1.activities.length == 1, e1.activities.length

    a = e1.activities[0]
    activity_yaml_file = a.to_yaml_file(p.pathname)

    files_deleted = sorted(e1.self_destruct(p))

    files_created = sorted(
        [file_written, comment_yaml_file, activity_yaml_file])

    print("files_deleted is %s" % files_deleted)
    print("files_created is %s" % files_created)

    assert files_deleted == files_created

    assert not os.path.exists(file_written)
开发者ID:gitmob,项目名称:pitz,代码行数:39,代码来源:test_entity.py


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