MCPcopy Create free account
hub / github.com/ccxt/ccxt / test_ws_cache

Function test_ws_cache

python/ccxt/pro/test/base/test_cache.py:25–616  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

23
24# ----------------------------------------------------------------------------
25def test_ws_cache():
26 array_cache = ArrayCache(3)
27 array_cache.append({
28 'symbol': 'BTC/USDT',
29 'data': 1,
30 })
31 array_cache.append({
32 'symbol': 'BTC/USDT',
33 'data': 2,
34 })
35 array_cache.append({
36 'symbol': 'BTC/USDT',
37 'data': 3,
38 })
39 array_cache.append({
40 'symbol': 'BTC/USDT',
41 'data': 4,
42 })
43 assert(equals(array_cache, [{
44 'symbol': 'BTC/USDT',
45 'data': 2,
46}, {
47 'symbol': 'BTC/USDT',
48 'data': 3,
49}, {
50 'symbol': 'BTC/USDT',
51 'data': 4,
52}]))
53 array_cache.append({
54 'symbol': 'BTC/USDT',
55 'data': 5,
56 })
57 array_cache.append({
58 'symbol': 'BTC/USDT',
59 'data': 6,
60 })
61 array_cache.append({
62 'symbol': 'BTC/USDT',
63 'data': 7,
64 })
65 array_cache.append({
66 'symbol': 'BTC/USDT',
67 'data': 8,
68 })
69 assert(equals(array_cache, [{
70 'symbol': 'BTC/USDT',
71 'data': 6,
72}, {
73 'symbol': 'BTC/USDT',
74 'data': 7,
75}, {
76 'symbol': 'BTC/USDT',
77 'data': 8,
78}]))
79 array_cache.clear()
80 array_cache.append({
81 'symbol': 'BTC/USDT',
82 'data': 1,

Callers 1

test_base_init_wsFunction · 0.90

Calls 12

appendMethod · 0.95
appendMethod · 0.95
appendMethod · 0.95
appendMethod · 0.95
ArrayCacheClass · 0.90
get_limitMethod · 0.80
equalsFunction · 0.70
rangeFunction · 0.50
clearMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…