Skip to content

Commit 6d2135b

Browse files
committed
Updated todo, added session test stubs
1 parent e89401c commit 6d2135b

File tree

7 files changed

+64
-66
lines changed

7 files changed

+64
-66
lines changed

CommandInterpreter.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55

66
class CommandInterpreter:
7-
actions_branch_name = '@action_tests'
8-
97
def __init__(self, root: Session):
108
self.root = root
119

TreeRoot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
class TreeRoot(Session):
6-
actions_branch_name = '@action_tests'
6+
actions_branch_name = '@actions'
77

88
def __init__(self):
99
super().__init__()

tests/ActionNodeTests.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,12 @@ def test_absolute_path(self):
6666

6767
def test_path(self):
6868
act = ActionNode(path='foo', callback=lambda x: x)
69-
self.assertEquals(NodePath('foo'), act.path)
69+
self.assertEqual(NodePath('foo'), act.path)
7070

7171
def test_path_nested(self):
7272
action_path = NodePath('foo.bar')
7373
act = ActionNode(path=action_path, callback=lambda x: x)
74-
self.assertEquals(NodePath('foo.bar'), act.path)
74+
self.assertEqual(NodePath('foo.bar'), act.path)
7575

7676

7777
if __name__ == '__main__':

tests/TemporarySession.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
from Node import Node
12
from Session import *
23

34

45
class TemporarySession(Session):
56
def __init__(self, underlying_session: Session, temp_path: NodePath):
67
self.backend = underlying_session
78
self.temp_path = temp_path
9+
self.temp_node = Node()
810
self.start()
911

1012
def start(self):
@@ -14,5 +16,4 @@ def finish(self):
1416
self.remove(self.temp_path)
1517

1618
def execute(self, target: NodePath, action, *arguments):
17-
# Forward all action_tests to the backend
1819
return self.backend.execute(target, action, *arguments)

tests/TemporarySessionTests.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,39 @@ def test_finish(self):
2626
self.assertFalse(self.session.exists(self.path))
2727

2828

29+
class TemporaryStorageSessionTests(unittest.TestCase):
30+
def setUp(self):
31+
self.path = NodePath('.temp')
32+
self.base = TreeRoot()
33+
self.base.create('.existing')
34+
self.first = TemporarySession(self.base, self.path)
35+
self.second = TemporarySession(self.base, self.path)
36+
37+
def test_existing_path(self):
38+
pass # TODO: how this session should behave?
39+
self.assertTrue(self.base.exists('.existing'))
40+
session = TemporarySession(self.base, '.existing')
41+
42+
def test_virtual_node_exists(self):
43+
self.assertFalse(self.base.exists(self.path))
44+
self.assertTrue(self.first.exists(self.path))
45+
self.assertTrue(self.second.exists(self.path))
46+
47+
def test_independent_create(self):
48+
node_path = NodePath.join(self.path, 'node')
49+
50+
self.assertFalse(self.first.exists(node_path))
51+
self.assertFalse(self.second.exists(node_path))
52+
self.first.create(node_path, 123)
53+
self.assertTrue(self.first.exists(node_path))
54+
self.assertFalse(self.second.exists(node_path))
55+
56+
self.second.create(node_path, 321)
57+
self.assertTrue(self.second.exists(node_path))
58+
59+
self.assertEqual(123, self.first.get(node_path))
60+
self.assertEqual(321, self.second.get(node_path))
61+
62+
2963
if __name__ == '__main__':
3064
unittest.main()

tests/VirtualAttributeTests

Lines changed: 0 additions & 32 deletions
This file was deleted.

todo.yaml

Lines changed: 25 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,51 @@
1-
Tree:
2-
- Self-awareness - .contexttree (or similar) branch
1+
Tree backend:
32
- Serialization to file
43
- Values
54
- Actions
65
- Type safety
76
- Action parameter tree (generation?)
87
- Action argument validation according to parameter tree
9-
+ Removal of nodes (just test delete action)
108
- Read-only nodes
119
- In-tree links support?
1210
- Easy creation of custom nodes from python classes
13-
- Find a way to implement @name, @path and @parent for every Node
14-
? Implement @parent virtual attribute (with in-tree links?)
15-
? Decorators:
16-
+ Sort after dynamic node creation
17-
? Create nodes in order in which decorators were defined
18-
+ Take care of automatic parameter encapsulation (e.g. from Node<int> to just bare int)
19-
+ @Attribute decorator
20-
- Add attribute rewrite to work with bare python classes (use @CreatorFunction to do this?)
21-
- Add (nested) path parameter
22-
? @Subnode decorator
23-
+ @Action decorator
24-
+ Support for subactions
25-
+ Add method rewrite to work with bare python classes
26-
+ Add (nested) path parameter
27-
- @VirtualNode - for on-request node generation (Node.append_node_generator)
28-
- Add 'Node.' prefix too all node-related action_tests
11+
+ @action decorator
12+
- Virtual attributes:
13+
- @name
14+
- @path
15+
- @parent
16+
- Add 'Node.' prefix too all node-related actions
2917
- Customizable search path (or virtually merged branches)
3018
- Sessions/TreeViews
3119
- Server-client architecture
3220
- Index addressing
3321
- Anonymous (without name) nodes
3422

3523
Functionality:
36-
- System executables as action_tests
37-
- File-to-node mapping
38-
- select and selected action_tests
39-
- Date/Time types
24+
- Sessions:
25+
- Temporary
26+
- select(ed)
27+
- copy/cut/paste
28+
- Transaction
29+
- system settings update
30+
- Network transport
31+
- Security/permissions
32+
- Filesystem mapping?
33+
- virtual attributes?
34+
- Self-awareness - .contexttree (or similar) branch
35+
- Date/Time node
4036
- System time reading
4137
- Filesystem mapping
42-
- copy, cut and paste action_tests (using select(ed) action?)
38+
- System executables as actions
39+
- copy, cut and paste actions (using select(ed) action?)
4340
- mime-type based file typing
4441
- create.int
4542
- create.string
4643
- create.link
4744
- create.<type>
48-
- list.attributes
49-
- list.action_tests
50-
- list.all
51-
- list.nodes
45+
+ list.attributes
46+
- list.actions
47+
+ list.all
48+
+ list.nodes
5249
- select/selected
5350
- temporary/session storage
5451
- links

0 commit comments

Comments
 (0)