Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
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
Boxiang Sun
cython
Commits
2076c9a6
Commit
2076c9a6
authored
Feb 28, 2013
by
zaur
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add missing files
parent
b58f69d2
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
58 additions
and
0 deletions
+58
-0
tests/run/datetime_members.pyx
tests/run/datetime_members.pyx
+58
-0
No files found.
tests/run/datetime_members.pyx
0 → 100644
View file @
2076c9a6
from
cpython.datetime
cimport
PyDateTime_IMPORT
from
cpython.datetime
cimport
time_new
,
date_new
,
datetime_new
,
timedelta_new
from
cpython.datetime
cimport
time_tzinfo
,
datetime_tzinfo
from
cpython.datetime
cimport
time_hour
,
time_minute
,
time_second
,
time_microsecond
from
cpython.datetime
cimport
date_day
,
date_month
,
date_year
from
cpython.datetime
cimport
datetime_day
,
datetime_month
,
datetime_year
from
cpython.datetime
cimport
datetime_hour
,
datetime_minute
,
datetime_second
,
\
datetime_microsecond
from
cpython.datetime
cimport
timedelta_days
,
timedelta_seconds
,
timedelta_microseconds
PyDateTime_IMPORT
def
test_date
(
int
year
,
int
month
,
int
day
):
'''
>>> test_date(2012,12,31)
(True, True, True)
'''
o
=
date_new
(
year
,
month
,
day
)
return
o
.
year
==
date_year
(
o
),
\
o
.
month
==
date_month
(
o
),
\
o
.
day
==
date_day
(
o
)
def
test_datetime
(
int
year
,
int
month
,
int
day
,
int
hour
,
int
minute
,
int
second
,
int
microsecond
):
'''
>>> test_datetime(2012, 12, 31, 12, 30, 59, 12345)
(True, True, True, True, True, True, True)
'''
o
=
datetime_new
(
year
,
month
,
day
,
hour
,
minute
,
second
,
microsecond
,
None
)
return
o
.
year
==
datetime_year
(
o
),
\
o
.
month
==
datetime_month
(
o
),
\
o
.
day
==
datetime_day
(
o
),
\
o
.
hour
==
datetime_hour
(
o
),
\
o
.
minute
==
datetime_minute
(
o
),
\
o
.
second
==
datetime_second
(
o
),
\
o
.
microsecond
==
datetime_microsecond
(
o
)
def
test_time
(
int
hour
,
int
minute
,
int
second
,
int
microsecond
):
'''
>>> test_time(12, 30, 59, 12345)
(True, True, True, True)
'''
o
=
time_new
(
hour
,
minute
,
second
,
microsecond
,
None
)
return
o
.
hour
==
time_hour
(
o
),
\
o
.
minute
==
time_minute
(
o
),
\
o
.
second
==
time_second
(
o
),
\
o
.
microsecond
==
time_microsecond
(
o
)
def
test_timedelta
(
int
days
,
int
seconds
,
int
microseconds
):
'''
>>> test_timedelta(30, 1440, 123456)
(True, True, True)
'''
o
=
timedelta_new
(
days
,
seconds
,
microseconds
)
return
o
.
days
==
timedelta_days
(
o
),
\
o
.
seconds
==
timedelta_seconds
(
o
),
\
o
.
microseconds
==
timedelta_microseconds
(
o
)
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