本文整理汇总了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)
示例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)