Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
46f4e79a
Commit
46f4e79a
authored
May 06, 2003
by
Skip Montanaro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test case for bsddb185 module
parent
823ba28b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
0 deletions
+40
-0
Lib/test/test_bsddb185.py
Lib/test/test_bsddb185.py
+40
-0
No files found.
Lib/test/test_bsddb185.py
0 → 100644
View file @
46f4e79a
from
test.test_support
import
verbose
,
run_unittest
,
findfile
import
unittest
import
bsddb185
import
anydbm
import
whichdb
import
os
import
tempfile
class
Bsddb185Tests
(
unittest
.
TestCase
):
def
test_open_existing_hash
(
self
):
"verify we can open a file known to be a hash v2 file"
# do we need to worry about big vs little endian?
db
=
bsddb185
.
hashopen
(
findfile
(
"185test.db"
))
self
.
assertEqual
(
db
[
"1"
],
"1"
)
db
.
close
()
def
test_whichdb
(
self
):
"verify that whichdb correctly sniffs the known hash v2 file"
self
.
assertEqual
(
whichdb
.
whichdb
(
findfile
(
"185test.db"
)),
"bsddb185"
)
def
test_anydbm_create
(
self
):
"verify that anydbm.open does *not* create a bsddb185 file"
tmpdir
=
tempfile
.
mkdtemp
()
try
:
try
:
dbfile
=
os
.
path
.
join
(
tmpdir
,
"foo.db"
)
anydbm
.
open
(
dbfile
,
"c"
).
close
()
ftype
=
whichdb
.
whichdb
(
findfile
(
"foo.db"
))
self
.
assertNotEqual
(
ftype
,
"bsddb185"
)
finally
:
os
.
unlink
(
dbfile
)
finally
:
os
.
rmdir
(
tmpdir
)
def
test_main
():
run_unittest
(
Bsddb185Tests
)
if
__name__
==
"__main__"
:
test_main
()
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