Skip to content

Commit 897e492

Browse files
author
Roman
committed
add test
1 parent a4707f8 commit 897e492

File tree

2 files changed

+157
-0
lines changed

2 files changed

+157
-0
lines changed

tests/unit_tests/chain_data/__init__.py

Whitespace-only changes.
Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
from bittensor.core.chain_data.metagraph_info import process_nested, _chr_str
2+
3+
4+
def test_process_nested():
5+
"""Tests process_nested function."""
6+
# Preps
7+
data = (
8+
None,
9+
{
10+
"name": (
11+
89,
12+
117,
13+
109,
14+
97,
15+
44,
16+
32,
17+
97,
18+
32,
19+
68,
20+
67,
21+
71,
22+
32,
23+
67,
24+
111,
25+
109,
26+
112,
27+
97,
28+
110,
29+
121,
30+
),
31+
"url": (
32+
104,
33+
116,
34+
116,
35+
112,
36+
115,
37+
58,
38+
47,
39+
47,
40+
121,
41+
117,
42+
109,
43+
97,
44+
97,
45+
105,
46+
46,
47+
99,
48+
111,
49+
109,
50+
47,
51+
),
52+
"github_repo": (),
53+
"image": (
54+
104,
55+
116,
56+
116,
57+
112,
58+
115,
59+
58,
60+
47,
61+
47,
62+
116,
63+
105,
64+
110,
65+
121,
66+
117,
67+
114,
68+
108,
69+
46,
70+
99,
71+
111,
72+
109,
73+
47,
74+
50,
75+
121,
76+
121,
77+
120,
78+
100,
79+
106,
80+
98,
81+
112,
82+
),
83+
"discord": (),
84+
"description": (
85+
89,
86+
117,
87+
109,
88+
97,
89+
32,
90+
112,
91+
111,
92+
119,
93+
101,
94+
114,
95+
115,
96+
32,
97+
116,
98+
114,
99+
97,
100+
110,
101+
115,
102+
102,
103+
111,
104+
114,
105+
109,
106+
97,
107+
116,
108+
105,
109+
118,
110+
101,
111+
32,
112+
112,
113+
114,
114+
111,
115+
106,
116+
101,
117+
99,
118+
116,
119+
115,
120+
32,
121+
111,
122+
110,
123+
32,
124+
66,
125+
105,
126+
116,
127+
116,
128+
101,
129+
110,
130+
115,
131+
111,
132+
114,
133+
46,
134+
),
135+
"additional": (),
136+
},
137+
None,
138+
)
139+
expected_result = [
140+
None,
141+
{
142+
"additional": "",
143+
"description": "Yuma powers transformative projects on Bittensor.",
144+
"discord": "",
145+
"github_repo": "",
146+
"image": "https://tinyurl.com/2yyxdjbp",
147+
"name": "Yuma, a DCG Company",
148+
"url": "https://yumaai.com/",
149+
},
150+
None,
151+
]
152+
153+
# Call
154+
result = process_nested(data, _chr_str)
155+
156+
# Asserts
157+
assert result == expected_result

0 commit comments

Comments
 (0)