コード例 #1
0
ファイル: test_entity.py プロジェクト: gitmob/pitz
def test_replace_objects_with_pointers():

    e1 = Entity(title="e1", a=1, b=2)
    e2 = Entity(title="e2", a=2, b=3)

    e1['friend'] = e2

    e1.replace_objects_with_pointers()
    assert e1['friend'] == e2.uuid, e1['friend']
コード例 #2
0
ファイル: test_entity.py プロジェクト: gitmob/pitz
    def test_2(self):

        p = Project()
        est1 = Entity(p, title='4 days')
        est1_uuid = est1.uuid

        e1 = Entity(p, title='some task', estimate=est1)
        e1.replace_objects_with_pointers()

        est2 = Entity(p, title=est1.title, uuid=uuid.uuid4())
        assert est2 is est1
        assert est1_uuid != est2.uuid

        e2 = Entity(p, title='another task', estimate=est2)
        e2.replace_objects_with_pointers()

        assert e1['estimate'] != e2['estimate'], est2['estimate']

        e1.replace_pointers_with_objects()
        e2.replace_pointers_with_objects()

        assert e1['estimate'] == e2['estimate'], est2['estimate']