FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
matplotlib/unit/dates_unit.py at transforms · staticor/matplotlib · GitHub
staticor
matplotlib
Repository navigation
Code
Pull requests
Actions
Projects
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
matplotlib
/
unit
/
dates_unit.py
Copy path
More file actions
More file actions
Latest commit
History
History
History
34 lines (27 loc) · 928 Bytes
Breadcrumbs
matplotlib
/
unit
/
dates_unit.py
Copy path
File metadata and controls
34 lines (27 loc) · 928 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
Check to and form the epoch conversions for the various datetime
converters
"""
from
matplotlib
.
dates
import
MxDatetimeConverter
,
PyDatetimeConverter
,\
EpochConverter
import
mx
.
DateTime
dt1
=
mx
.
DateTime
.
DateTime
(
2004
,
03
,
01
)
# before dst
dt2
=
mx
.
DateTime
.
DateTime
(
2004
,
04
,
15
)
# after dst
dtc
=
MxDatetimeConverter
()
assert
(
dtc
.
from_epoch
(
dtc
.
epoch
(
dt1
) )
==
dt1
)
assert
(
dtc
.
from_epoch
(
dtc
.
epoch
(
dt2
) )
==
dt2
)
print
'passed mx tests'
import
datetime
dt1
=
datetime
.
datetime
(
2004
,
03
,
01
)
# before dst
dt2
=
datetime
.
datetime
(
2004
,
04
,
15
)
# after dst
dtc
=
PyDatetimeConverter
()
assert
(
dtc
.
from_epoch
(
dtc
.
epoch
(
dt1
) )
==
dt1
)
assert
(
dtc
.
from_epoch
(
dtc
.
epoch
(
dt2
) )
==
dt2
)
print
'passed datetime tests'
# epoch
dt1
=
12345334
dt2
=
76543134
dtc
=
EpochConverter
()
assert
(
dtc
.
from_epoch
(
dtc
.
epoch
(
dt1
) )
==
dt1
)
assert
(
dtc
.
from_epoch
(
dtc
.
epoch
(
dt2
) )
==
dt2
)
print
'passed epoch tests'
Back
|
FazBrowse Home
|
New Git URL