File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ def decode_list(b):
53
53
if isinstance (b , list ):
54
54
return [nativestr (obj ) for obj in b ]
55
55
elif isinstance (b , bytes ):
56
- return nativestr (b )
56
+ return unstring ( nativestr (b ) )
57
57
elif isinstance (b , str ):
58
58
return unstring (b )
59
59
return b
Original file line number Diff line number Diff line change 2
2
import redis
3
3
from redis .commands .json .path import Path
4
4
from redis import exceptions
5
+ from redis .commands .json .decoders import unstring , decode_list
5
6
from .conftest import skip_ifmodversion_lt
6
7
7
8
@@ -1374,3 +1375,13 @@ def test_arrindex_dollar(client):
1374
1375
"test_None" ,
1375
1376
"..nested2_not_found.arr" ,
1376
1377
"None" ) == 0
1378
+
1379
+
1380
+ def test_decoders_and_unstring ():
1381
+ assert unstring ("4" ) == 4
1382
+ assert unstring ("45.55" ) == 45.55
1383
+ assert unstring ("hello world" ) == "hello world"
1384
+
1385
+ assert decode_list (b"45.55" ) == 45.55
1386
+ assert decode_list ("45.55" ) == 45.55
1387
+ assert decode_list (['hello' , b'world' ]) == ['hello' , 'world' ]
You can’t perform that action at this time.
0 commit comments