Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BTrees
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
BTrees
Commits
ef74b918
Commit
ef74b918
authored
Dec 12, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Get unicode-driven tests sane under Py3k.
parent
9ec6660f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
13 deletions
+17
-13
BTrees/tests/testBTreesUnicode.py
BTrees/tests/testBTreesUnicode.py
+17
-13
No files found.
BTrees/tests/testBTreesUnicode.py
View file @
ef74b918
...
...
@@ -28,30 +28,34 @@ class TestBTreesUnicode(unittest.TestCase):
def
setUp
(
self
):
#setup an OOBTree with some unicode strings
from
BTrees.OOBTree
import
OOBTree
from
BTrees._compat
import
_bytes
from
BTrees._compat
import
_u
self
.
s
=
unicode
(
'dreit
\
xe4
gigen'
,
'latin1'
)
self
.
s
=
_u
(
b
'dreit
\
xe4
gigen'
,
'latin1'
)
self
.
data
=
[(
'alien'
,
1
),
(
'k
\
xf6
nnten'
,
2
),
(
'fox'
,
3
),
(
'future'
,
4
),
(
'quick'
,
5
),
(
'zerst
\
xf6
rt'
,
6
),
(
unicode
(
'dreit
\
xe4
gigen'
,
'latin1'
),
7
),
self
.
data
=
[(
b
'alien'
,
1
),
(
b
'k
\
xf6
nnten'
,
2
),
(
b
'fox'
,
3
),
(
b
'future'
,
4
),
(
b
'quick'
,
5
),
(
b
'zerst
\
xf6
rt'
,
6
),
(
_u
(
b
'dreit
\
xe4
gigen'
,
'latin1'
),
7
),
]
self
.
tree
=
OOBTree
()
for
k
,
v
in
self
.
data
:
if
isinstance
(
k
,
str
):
k
=
unicode
(
k
,
'latin1'
)
if
isinstance
(
k
,
_bytes
):
k
=
_u
(
k
,
'latin1'
)
self
.
tree
[
k
]
=
v
@
_skip_under_Py3k
def
testAllKeys
(
self
):
# check every item of the tree
from
BTrees._compat
import
_u
from
BTrees._compat
import
_bytes
for
k
,
v
in
self
.
data
:
if
isinstance
(
k
,
str
):
k
=
unicode
(
k
,
encoding
)
if
isinstance
(
k
,
_bytes
):
k
=
_u
(
k
,
encoding
)
self
.
assertTrue
(
k
in
self
.
tree
)
self
.
assertEqual
(
self
.
tree
[
k
],
v
)
...
...
@@ -67,7 +71,7 @@ class TestBTreesUnicode(unittest.TestCase):
def
testAsciiKeys
(
self
):
# try to access some "plain ASCII" keys in the tree
for
k
,
v
in
self
.
data
[
0
],
self
.
data
[
2
]:
self
.
assert
_
(
isinstance
(
k
,
str
))
self
.
assert
True
(
isinstance
(
k
,
str
))
self
.
assertEqual
(
self
.
tree
[
k
],
v
)
def
test_suite
():
...
...
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