Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5-Boxiang
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Hamza
erp5-Boxiang
Commits
23e45342
Commit
23e45342
authored
Mar 06, 2015
by
Xiaowu Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
testField: modify datetimefield's test since it don't use sub form anymore
parent
2f8a4781
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
25 deletions
+5
-25
product/ERP5Form/tests/testFields.py
product/ERP5Form/tests/testFields.py
+5
-25
No files found.
product/ERP5Form/tests/testFields.py
View file @
23e45342
...
@@ -938,8 +938,6 @@ class TestFieldValueCache(ERP5TypeTestCase):
...
@@ -938,8 +938,6 @@ class TestFieldValueCache(ERP5TypeTestCase):
addField
(
DateTimeField
(
'datetime_field'
))
addField
(
DateTimeField
(
'datetime_field'
))
form
.
datetime_field
.
_p_oid
=
makeDummyOid
()
form
.
datetime_field
.
_p_oid
=
makeDummyOid
()
form
.
datetime_field
.
_edit
(
dict
(
input_style
=
'list'
))
form
.
datetime_field
.
_edit
(
dict
(
input_style
=
'list'
))
for
i
in
form
.
datetime_field
.
sub_form
.
fields
.
values
():
i
.
_p_oid
=
makeDummyOid
()
def
test_method_field
(
self
):
def
test_method_field
(
self
):
field
=
self
.
root
.
form
.
field
field
=
self
.
root
.
form
.
field
...
@@ -985,40 +983,22 @@ class TestFieldValueCache(ERP5TypeTestCase):
...
@@ -985,40 +983,22 @@ class TestFieldValueCache(ERP5TypeTestCase):
def
test_datetime_field
(
self
):
def
test_datetime_field
(
self
):
field_value_cache
.
clear
()
field_value_cache
.
clear
()
# make sure that boundmethod must not be cached.
year_field
=
self
.
root
.
form
.
datetime_field
.
sub_form
.
get_field
(
'year'
,
include_disabled
=
1
)
self
.
assertEqual
(
True
,
type
(
year_field
.
overrides
[
'items'
])
is
BoundMethod
)
cache_size
=
len
(
field_value_cache
)
cache_size
=
len
(
field_value_cache
)
year_field
.
get_value
(
'items'
)
#since datetimefield do not use sub form in initialization
#start_datetime and end_datetime will not be cached
# See Formulator/StandardFields.py(line:174)
self
.
assertEqual
(
False
,
(
'Form.get_value'
,
# there are two get_value, start_datetime and end_datetime
cache_size
+=
2
# make sure that boundmethod is not cached(cache size does not change)
self
.
assertEqual
(
True
,
(
'Form.get_value'
,
self
.
root
.
form
.
datetime_field
.
_p_oid
,
self
.
root
.
form
.
datetime_field
.
_p_oid
,
self
.
root
.
form
.
datetime_field
.
_p_oid
,
self
.
root
.
form
.
datetime_field
.
_p_oid
,
'start_datetime'
'start_datetime'
)
in
field_value_cache
)
)
in
field_value_cache
)
self
.
assertEqual
(
Tru
e
,
(
'Form.get_value'
,
self
.
assertEqual
(
Fals
e
,
(
'Form.get_value'
,
self
.
root
.
form
.
datetime_field
.
_p_oid
,
self
.
root
.
form
.
datetime_field
.
_p_oid
,
self
.
root
.
form
.
datetime_field
.
_p_oid
,
self
.
root
.
form
.
datetime_field
.
_p_oid
,
'end_datetime'
'end_datetime'
)
in
field_value_cache
)
)
in
field_value_cache
)
self
.
assertEqual
(
False
,
(
'Form.get_value'
,
#ensure len is not changed
year_field
.
_p_oid
,
year_field
.
_p_oid
,
'items'
)
in
field_value_cache
)
self
.
assertEqual
(
cache_size
,
len
(
field_value_cache
))
self
.
assertEqual
(
cache_size
,
len
(
field_value_cache
))
year_field
.
get_value
(
'size'
)
year_field
.
get_value
(
'default'
)
self
.
assertEqual
(
cache_size
+
2
,
len
(
field_value_cache
))
def
makeDummyOid
():
def
makeDummyOid
():
import
time
,
random
import
time
,
random
return
'%s%s'
%
(
time
.
time
(),
random
.
random
())
return
'%s%s'
%
(
time
.
time
(),
random
.
random
())
...
...
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