Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Zope
Commits
3c206d0a
Commit
3c206d0a
authored
Mar 17, 2005
by
Sidnei da Silva
Browse files
Options
Browse Files
Download
Plain Diff
parents
5573608a
583028d8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
7 deletions
+75
-7
lib/python/Shared/DC/ZRDB/RDB.py
lib/python/Shared/DC/ZRDB/RDB.py
+3
-4
lib/python/Shared/DC/ZRDB/Results.py
lib/python/Shared/DC/ZRDB/Results.py
+3
-3
lib/python/Shared/DC/ZRDB/tests/__init__.py
lib/python/Shared/DC/ZRDB/tests/__init__.py
+1
-0
lib/python/Shared/DC/ZRDB/tests/testResult.py
lib/python/Shared/DC/ZRDB/tests/testResult.py
+68
-0
No files found.
lib/python/Shared/DC/ZRDB/RDB.py
View file @
3c206d0a
...
...
@@ -141,9 +141,9 @@ class DatabaseResults:
setattr
(
r
,
k
,
getattr
(
Record
,
k
))
# Add SQL Aliases
d
=
r
.
__dict__
for
k
,
v
in
aliases
:
if
not
hasattr
(
r
,
k
):
d
[
k
]
=
v
if
not
hasattr
(
r
,
k
):
setattr
(
r
,
k
,
v
)
if
hasattr
(
brains
,
'__init__'
):
binit
=
brains
.
__init__
...
...
@@ -152,8 +152,7 @@ class DatabaseResults:
Record
.
__init__
(
self
,
data
)
binit
(
self
.
__of__
(
parent
))
r
.
__dict__
[
'__init__'
]
=
__init__
setattr
(
r
,
'__init__'
,
__init__
)
self
.
_class
=
r
...
...
lib/python/Shared/DC/ZRDB/Results.py
View file @
3c206d0a
...
...
@@ -71,9 +71,9 @@ class Results:
setattr
(
r
,
k
,
getattr
(
Record
,
k
))
# Add SQL Aliases
d
=
r
.
__dict__
for
k
,
v
in
aliases
:
if
not
hasattr
(
r
,
k
):
d
[
k
]
=
v
if
not
hasattr
(
r
,
k
):
setattr
(
r
,
k
,
v
)
if
hasattr
(
brains
,
'__init__'
):
binit
=
brains
.
__init__
...
...
@@ -83,7 +83,7 @@ class Results:
if
parent
is
not
None
:
self
=
self
.
__of__
(
parent
)
binit
(
self
)
r
.
__dict__
[
'__init__'
]
=
__init__
setattr
(
r
,
'__init__'
,
__init__
)
self
.
_class
=
r
...
...
lib/python/Shared/DC/ZRDB/tests/__init__.py
0 → 100644
View file @
3c206d0a
# import this
lib/python/Shared/DC/ZRDB/tests/testResult.py
0 → 100644
View file @
3c206d0a
from
unittest
import
TestCase
,
TestSuite
,
makeSuite
,
main
from
cStringIO
import
StringIO
from
ExtensionClass
import
Base
from
Shared.DC.ZRDB.Results
import
Results
from
Shared.DC.ZRDB
import
RDB
class
Brain
:
def
__init__
(
self
,
*
args
):
pass
Parent
=
Base
()
class
TestResults
(
TestCase
):
def
test_results
(
self
):
r
=
Results
(([{
'name'
:
'foo'
,
'type'
:
'integer'
},
{
'name'
:
'bar'
,
'type'
:
'integer'
}],
((
1
,
2
),
(
3
,
4
))),
brains
=
Brain
,
parent
=
Parent
)
self
.
assertEquals
(
len
(
r
),
2
)
row
=
r
[
0
]
self
.
assertEquals
(
row
[
0
],
1
)
self
.
assertEquals
(
row
[
1
],
2
)
self
.
assertEquals
(
row
.
foo
,
1
)
self
.
assertEquals
(
row
.
bar
,
2
)
self
.
assertEquals
(
row
.
FOO
,
1
)
self
.
assertEquals
(
row
.
BAR
,
2
)
row
=
r
[
1
]
self
.
assertEquals
(
row
[
0
],
3
)
self
.
assertEquals
(
row
[
1
],
4
)
self
.
assertEquals
(
row
.
foo
,
3
)
self
.
assertEquals
(
row
.
bar
,
4
)
self
.
assertEquals
(
row
.
FOO
,
3
)
self
.
assertEquals
(
row
.
BAR
,
4
)
self
.
failUnless
(
isinstance
(
row
,
Brain
))
def
test_rdb_file
(
self
):
infile
=
StringIO
(
"""
\
foo
\
t
bar
2i
\
t
2i
1
\
t
2
3
\
t
4
\
"""
)
r
=
RDB
.
File
(
infile
,
brains
=
Brain
,
parent
=
Parent
)
self
.
assertEquals
(
len
(
r
),
2
)
row
=
r
[
0
]
self
.
assertEquals
(
row
[
0
],
1
)
self
.
assertEquals
(
row
[
1
],
2
)
self
.
assertEquals
(
row
.
foo
,
1
)
self
.
assertEquals
(
row
.
bar
,
2
)
self
.
assertEquals
(
row
.
FOO
,
1
)
self
.
assertEquals
(
row
.
BAR
,
2
)
row
=
r
[
1
]
self
.
assertEquals
(
row
[
0
],
3
)
self
.
assertEquals
(
row
[
1
],
4
)
self
.
assertEquals
(
row
.
foo
,
3
)
self
.
assertEquals
(
row
.
bar
,
4
)
self
.
assertEquals
(
row
.
FOO
,
3
)
self
.
assertEquals
(
row
.
BAR
,
4
)
self
.
failUnless
(
isinstance
(
row
,
Brain
))
def
test_suite
():
return
TestSuite
((
makeSuite
(
TestResults
),))
if
__name__
==
'__main__'
:
main
(
defaultTest
=
'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