forked from ccxt/ccxt
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_exchange_datetime_functions.py
More file actions
59 lines (41 loc) · 2.09 KB
/
test_exchange_datetime_functions.py
File metadata and controls
59 lines (41 loc) · 2.09 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import os
import sys
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(root)
# ----------------------------------------------------------------------------
# PLEASE DO NOT EDIT THIS FILE, IT IS GENERATED AND WILL BE OVERWRITTEN:
# https://github.com/ccxt/ccxt/blob/master/CONTRIBUTING.md#how-to-contribute-code
# ----------------------------------------------------------------------------
import ccxt # noqa: F402
# ----------------------------------------------------------------------------
exchange = ccxt.Exchange({
'id': 'regirock',
})
# ----------------------------------------------------------------------------
assert(exchange.iso8601(514862627000) == '1986-04-26T01:23:47.000Z')
assert(exchange.iso8601(514862627559) == '1986-04-26T01:23:47.559Z')
assert(exchange.iso8601(514862627062) == '1986-04-26T01:23:47.062Z')
assert(exchange.iso8601(0) == '1970-01-01T00:00:00.000Z')
assert(exchange.iso8601(-1) is None)
assert(exchange.iso8601() is None)
assert(exchange.iso8601(None) is None)
assert(exchange.iso8601('') is None)
assert(exchange.iso8601('a') is None)
assert(exchange.iso8601({}) is None)
# ----------------------------------------------------------------------------
assert(exchange.parse8601('1986-04-26T01:23:47.000Z') == 514862627000)
assert(exchange.parse8601('1986-04-26T01:23:47.559Z') == 514862627559)
assert(exchange.parse8601('1986-04-26T01:23:47.062Z') == 514862627062)
assert(exchange.parse8601('1977-13-13T00:00:00.000Z') is None)
assert(exchange.parse8601('1986-04-26T25:71:47.000Z') is None)
assert(exchange.parse8601('3333') is None)
assert(exchange.parse8601('Sr90') is None)
assert(exchange.parse8601('') is None)
assert(exchange.parse8601() is None)
assert(exchange.parse8601(None) is None)
assert(exchange.parse8601({}) is None)
assert(exchange.parse8601(33) is None)
# ----------------------------------------------------------------------------
assert(exchange.parse_date('1986-04-26 00:00:00') == 514857600000)
assert(exchange.parse_date('1986-04-26T01:23:47.000Z') == 514862627000)
assert(exchange.parse_date('1986-13-13 00:00:00') is None)