Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
persistent
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
persistent
Commits
c3173352
Commit
c3173352
authored
May 14, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coverage
parent
bc57fa76
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
11 deletions
+40
-11
persistent/tests/test_mapping.py
persistent/tests/test_mapping.py
+40
-11
No files found.
persistent/tests/test_mapping.py
View file @
c3173352
...
...
@@ -11,20 +11,44 @@
# FOR A PARTICULAR PURPOSE.
#
##############################################################################
import
doctest
import
unittest
def
test_suite
():
return
unittest
.
TestSuite
((
doctest
.
DocFileSuite
(
'README.txt'
),
))
l0
=
{}
l1
=
{
0
:
0
}
l2
=
{
0
:
0
,
1
:
1
}
class
Test_default
(
unittest
.
TestCase
):
class
MappingTests
(
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
persistent.mapping
import
default
return
default
def
_makeOne
(
self
,
func
):
return
self
.
_getTargetClass
()(
func
)
def
test___get___from_class
(
self
):
_called_with
=
[]
def
_test
(
inst
):
_called_with
.
append
(
inst
)
return
'_test'
descr
=
self
.
_makeOne
(
_test
)
class
Foo
(
object
):
testing
=
descr
self
.
assertTrue
(
Foo
.
testing
is
descr
)
self
.
assertEqual
(
_called_with
,
[])
def
test___get___from_instance
(
self
):
_called_with
=
[]
def
_test
(
inst
):
_called_with
.
append
(
inst
)
return
'TESTING'
descr
=
self
.
_makeOne
(
_test
)
class
Foo
(
object
):
testing
=
descr
foo
=
Foo
()
self
.
assertEqual
(
foo
.
testing
,
'TESTING'
)
self
.
assertEqual
(
_called_with
,
[
foo
])
class
PersistentMappingTests
(
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
persistent.mapping
import
PersistentMapping
...
...
@@ -41,6 +65,9 @@ class MappingTests(unittest.TestCase):
def
testTheWorld
(
self
):
# Test constructors
l0
=
{}
l1
=
{
0
:
0
}
l2
=
{
0
:
0
,
1
:
1
}
pm
=
self
.
_getTargetClass
()
u
=
pm
()
u0
=
pm
(
l0
)
...
...
@@ -215,7 +242,9 @@ without marking the object as changed:
"""
def
test_suite
():
import
doctest
return
unittest
.
TestSuite
((
doctest
.
DocTestSuite
(),
unittest
.
makeSuite
(
MappingTests
),
unittest
.
makeSuite
(
PersistentMappingTests
),
unittest
.
makeSuite
(
Test_default
),
))
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