Skip to content

Commit e8a5303

Browse files
committed
Cover both / and + in test
1 parent 162917c commit e8a5303

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/validators/config.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl ValBytesMode {
4949
}
5050

5151
fn to_base64_urlsafe(s: &str) -> String {
52-
if s.contains('+') || s.contains('/') {
52+
if s.contains(|c| c == '+' || c == '/') {
5353
s.replace('+', "-").replace('/', "_")
5454
} else {
5555
s.to_string()

tests/test_json.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -379,9 +379,9 @@ def test_partial_parse():
379379

380380

381381
def test_json_bytes_base64_round_trip():
382-
data = b'TDR3\xbe\x11J\xe9\x9f\xa4&\x91\xff\xc8\xef4\xdf\xd3$\xf3^\xca\xb5\x14V \xdeDH\n\x85\x8b'
383-
encoded_std = b'"VERSM74RSumfpCaR/8jvNN/TJPNeyrUUViDeREgKhYs="'
384-
encoded_url = b'"VERSM74RSumfpCaR_8jvNN_TJPNeyrUUViDeREgKhYs="'
382+
data = b'\xd8\x07\xc1Tx$\x91F%\xf3\xf3I\xca\xd8@\x0c\xee\xc3\xab\xff\x7f\xd3\xcd\xcd\xf9\xc2\x10\xe4\xa1\xb01e'
383+
encoded_std = b'"2AfBVHgkkUYl8/NJythADO7Dq/9/083N+cIQ5KGwMWU="'
384+
encoded_url = b'"2AfBVHgkkUYl8_NJythADO7Dq_9_083N-cIQ5KGwMWU="'
385385
assert to_json(data, bytes_mode='base64') == encoded_url
386386

387387
v = SchemaValidator({'type': 'bytes'}, {'val_json_bytes': 'base64'})

0 commit comments

Comments
 (0)