Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
627c1ab6
Commit
627c1ab6
authored
Jun 06, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
8fd0a998
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+13
-10
No files found.
wcfs/wcfs_test.py
View file @
627c1ab6
...
...
@@ -229,10 +229,13 @@ class tDB:
# change schedules zf to be changed according changeDelta at commit.
#
# changeDelta is {} blk -> data.
# data can be both bytes and unicode.
def
change
(
t
,
zf
,
changeDelta
):
assert
isinstance
(
zf
,
ZBigFile
)
zfDelta
=
t
.
_changed
.
setdefault
(
zf
,
{})
for
blk
,
data
in
changeDelta
.
iteritems
():
if
not
isinstance
(
data
,
bytes
):
data
=
data
.
encode
(
'utf-8'
)
assert
len
(
data
)
<=
zf
.
blksize
zfDelta
[
blk
]
=
data
...
...
@@ -853,29 +856,29 @@ def test_wcfs():
f
.
assertData
([],
mtime
=
at0
)
# >>> (@at1) commit data -> we can see it on wcfs
t
.
change
(
zf
,
{
2
:
b
'1γ'
})
t
.
change
(
zf
,
{
2
:
'1γ'
})
at1
=
t
.
commit
()
f
.
assertCache
([
0
,
0
,
0
])
# initially not cached
f
.
assertData
([
b''
,
b''
,
b
'1γ'
],
mtime
=
t
.
head
)
f
.
assertData
([
''
,
''
,
'1γ'
],
mtime
=
t
.
head
)
# >>> (@at2) commit again -> we can see both latest and snapshotted states
t
.
change
(
zf
,
{
2
:
b'2γ'
,
3
:
b
'2δ'
})
t
.
change
(
zf
,
{
2
:
'2γ'
,
3
:
'2δ'
})
at2
=
t
.
commit
()
# f @head
f
.
assertCache
([
1
,
1
,
0
,
0
])
f
.
assertData
([
b''
,
b''
,
b'2γ'
,
b
'2δ'
],
mtime
=
t
.
head
)
f
.
assertData
([
''
,
''
,
'2γ'
,
'2δ'
],
mtime
=
t
.
head
)
# f @at1
f1
=
t
.
open
(
zf
,
at
=
at1
)
f1
.
assertCache
([
0
,
0
,
1
])
f1
.
assertData
([
b''
,
b''
,
b
'1γ'
])
# XXX + mtime=at1?
f1
.
assertData
([
''
,
''
,
'1γ'
])
# XXX + mtime=at1?
# >>> (@at3) commit again without changing zf size
f2
=
t
.
open
(
zf
,
at
=
at2
)
t
.
change
(
zf
,
{
2
:
b
'3γ'
})
t
.
change
(
zf
,
{
2
:
'3γ'
})
at3
=
t
.
commit
()
f
.
assertCache
([
1
,
1
,
0
,
1
])
...
...
@@ -888,15 +891,15 @@ def test_wcfs():
# f @head
f
.
assertCache
([
1
,
1
,
0
,
1
])
f
.
assertData
([
b''
,
b''
,
b'3γ'
,
b
'2δ'
],
mtime
=
t
.
head
)
f
.
assertData
([
''
,
''
,
'3γ'
,
'2δ'
],
mtime
=
t
.
head
)
# f @at2
f2
.
assertCache
([
0
,
0
,
1
,
0
])
f2
.
assertData
([
b''
,
b''
,
b'2γ'
,
b
'2δ'
])
# XXX mtime=at2
f2
.
assertData
([
''
,
''
,
'2γ'
,
'2δ'
])
# XXX mtime=at2
# f @at1
f1
.
assertCache
([
1
,
1
,
1
])
f1
.
assertData
([
b''
,
b''
,
b
'1γ'
])
# XXX + mtime=at1?
f1
.
assertData
([
''
,
''
,
'1γ'
])
# XXX + mtime=at1?
# >>> f close / open again -> cache must not be lost
...
...
@@ -955,7 +958,7 @@ def test_wcfs():
wl
=
t
.
openwatch
()
wl
.
watch
(
zf
,
t
.
head
)
f
.
assertCache
([
1
,
1
,
1
,
1
])
t
.
change
(
zf
,
{
1
:
b'rio'
,
2
:
b'tty'
,
5
:
b
'big'
})
t
.
change
(
zf
,
{
1
:
'rio'
,
2
:
'tty'
,
5
:
'big'
})
at4
=
t
.
commit
()
f
.
assertCache
([
1
,
0
,
0
,
1
,
0
,
0
])
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment