39
39
id = "1-byte payload and extra padding" ,
40
40
),
41
41
pytest .param (
42
- b"\x00 \x00 \x00 \x0B \x00 \x03 \x00 \x00 hi\x00 " ,
42
+ b"\x00 \x00 \x00 \x0b \x00 \x03 \x00 \x00 hi\x00 " ,
43
43
Container (len = 11 , proto = pq3 .protocol (3 , 0 ), payload = [b"hi" ]),
44
44
b"" ,
45
45
id = "implied parameter list when using proto version 3.0" ,
@@ -64,7 +64,7 @@ def test_Startup_parse(raw, expected, extra):
64
64
),
65
65
pytest .param (
66
66
dict (len = 10 , proto = 0x12345678 ),
67
- b"\x00 \x00 \x00 \x0A \x12 \x34 \x56 \x78 \x00 \x00 " ,
67
+ b"\x00 \x00 \x00 \x0a \x12 \x34 \x56 \x78 \x00 \x00 " ,
68
68
id = "len and proto set explicitly" ,
69
69
),
70
70
pytest .param (
@@ -74,7 +74,7 @@ def test_Startup_parse(raw, expected, extra):
74
74
),
75
75
pytest .param (
76
76
dict (proto = 0x12345678 , payload = b"abcd" ),
77
- b"\x00 \x00 \x00 \x0C \x12 \x34 \x56 \x78 abcd" ,
77
+ b"\x00 \x00 \x00 \x0c \x12 \x34 \x56 \x78 abcd" ,
78
78
id = "implied len with payload" ,
79
79
),
80
80
pytest .param (
@@ -84,7 +84,7 @@ def test_Startup_parse(raw, expected, extra):
84
84
),
85
85
pytest .param (
86
86
dict (payload = [b"hi" , b"" ]),
87
- b"\x00 \x00 \x00 \x0C \x00 \x03 \x00 \x00 hi\x00 \x00 " ,
87
+ b"\x00 \x00 \x00 \x0c \x00 \x03 \x00 \x00 hi\x00 \x00 " ,
88
88
id = "implied proto version 3 and len when sending more than one parameter" ,
89
89
),
90
90
pytest .param (
@@ -131,7 +131,7 @@ def test_Startup_build(packet, expected_bytes):
131
131
id = "AuthenticationOk" ,
132
132
),
133
133
pytest .param (
134
- b"R\x00 \x00 \x00 \x12 \x00 \x00 \x00 \x0A EXTERNAL \x00 \x00 " ,
134
+ b"R\x00 \x00 \x00 \x12 \x00 \x00 \x00 \x0a EXTERNAL \x00 \x00 " ,
135
135
dict (
136
136
type = pq3 .types .AuthnRequest ,
137
137
len = 18 ,
@@ -141,7 +141,7 @@ def test_Startup_build(packet, expected_bytes):
141
141
id = "AuthenticationSASL" ,
142
142
),
143
143
pytest .param (
144
- b"R\x00 \x00 \x00 \x0D \x00 \x00 \x00 \x0B 12345 " ,
144
+ b"R\x00 \x00 \x00 \x0d \x00 \x00 \x00 \x0b 12345 " ,
145
145
dict (
146
146
type = pq3 .types .AuthnRequest ,
147
147
len = 13 ,
@@ -151,7 +151,7 @@ def test_Startup_build(packet, expected_bytes):
151
151
id = "AuthenticationSASLContinue" ,
152
152
),
153
153
pytest .param (
154
- b"R\x00 \x00 \x00 \x0D \x00 \x00 \x00 \x0C 12345 " ,
154
+ b"R\x00 \x00 \x00 \x0d \x00 \x00 \x00 \x0c 12345 " ,
155
155
dict (
156
156
type = pq3 .types .AuthnRequest ,
157
157
len = 13 ,
@@ -161,7 +161,7 @@ def test_Startup_build(packet, expected_bytes):
161
161
id = "AuthenticationSASLFinal" ,
162
162
),
163
163
pytest .param (
164
- b"p\x00 \x00 \x00 \x0B hunter2 " ,
164
+ b"p\x00 \x00 \x00 \x0b hunter2 " ,
165
165
dict (
166
166
type = pq3 .types .PasswordMessage ,
167
167
len = 11 ,
@@ -171,7 +171,7 @@ def test_Startup_build(packet, expected_bytes):
171
171
id = "PasswordMessage" ,
172
172
),
173
173
pytest .param (
174
- b"K\x00 \x00 \x00 \x0C \x00 \x00 \x00 \x00 \x12 \x34 \x56 \x78 " ,
174
+ b"K\x00 \x00 \x00 \x0c \x00 \x00 \x00 \x00 \x12 \x34 \x56 \x78 " ,
175
175
dict (
176
176
type = pq3 .types .BackendKeyData ,
177
177
len = 12 ,
@@ -219,7 +219,7 @@ def test_Startup_build(packet, expected_bytes):
219
219
id = "Query" ,
220
220
),
221
221
pytest .param (
222
- b"D\x00 \x00 \x00 \x0B \x00 \x01 \x00 \x00 \x00 \x01 !" ,
222
+ b"D\x00 \x00 \x00 \x0b \x00 \x01 \x00 \x00 \x00 \x01 !" ,
223
223
dict (type = pq3 .types .DataRow , len = 11 , payload = dict (columns = [b"!" ])),
224
224
b"" ,
225
225
id = "DataRow" ,
@@ -237,9 +237,9 @@ def test_Startup_build(packet, expected_bytes):
237
237
id = "EmptyQueryResponse" ,
238
238
),
239
239
pytest .param (
240
- b"I\x00 \x00 \x00 \x04 \xFF " ,
240
+ b"I\x00 \x00 \x00 \x04 \xff " ,
241
241
dict (type = b"I" , len = 4 , payload = None ),
242
- b"\xFF " ,
242
+ b"\xff " ,
243
243
id = "EmptyQueryResponse with extra bytes" ,
244
244
),
245
245
pytest .param (
@@ -278,7 +278,7 @@ def test_Pq3_parse(raw, expected, extra):
278
278
),
279
279
pytest .param (
280
280
dict (type = b"*" , len = 12 , payload = b"1234" ),
281
- b"*\x00 \x00 \x00 \x0C 1234 " ,
281
+ b"*\x00 \x00 \x00 \x0c 1234 " ,
282
282
id = "overridden len (payload underflow)" ,
283
283
),
284
284
pytest .param (
@@ -299,36 +299,36 @@ def test_Pq3_parse(raw, expected, extra):
299
299
body = [b"SCRAM-SHA-256-PLUS" , b"SCRAM-SHA-256" , b"" ],
300
300
),
301
301
),
302
- b"R\x00 \x00 \x00 \x2A \x00 \x00 \x00 \x0A SCRAM -SHA-256-PLUS\x00 SCRAM-SHA-256\x00 \x00 " ,
302
+ b"R\x00 \x00 \x00 \x2a \x00 \x00 \x00 \x0a SCRAM -SHA-256-PLUS\x00 SCRAM-SHA-256\x00 \x00 " ,
303
303
id = "implied len/type for AuthenticationSASL" ,
304
304
),
305
305
pytest .param (
306
306
dict (
307
307
type = pq3 .types .AuthnRequest ,
308
308
payload = dict (type = pq3 .authn .SASLContinue , body = b"12345" ),
309
309
),
310
- b"R\x00 \x00 \x00 \x0D \x00 \x00 \x00 \x0B 12345 " ,
310
+ b"R\x00 \x00 \x00 \x0d \x00 \x00 \x00 \x0b 12345 " ,
311
311
id = "implied len/type for AuthenticationSASLContinue" ,
312
312
),
313
313
pytest .param (
314
314
dict (
315
315
type = pq3 .types .AuthnRequest ,
316
316
payload = dict (type = pq3 .authn .SASLFinal , body = b"12345" ),
317
317
),
318
- b"R\x00 \x00 \x00 \x0D \x00 \x00 \x00 \x0C 12345 " ,
318
+ b"R\x00 \x00 \x00 \x0d \x00 \x00 \x00 \x0c 12345 " ,
319
319
id = "implied len/type for AuthenticationSASLFinal" ,
320
320
),
321
321
pytest .param (
322
322
dict (
323
323
type = pq3 .types .PasswordMessage ,
324
324
payload = b"hunter2" ,
325
325
),
326
- b"p\x00 \x00 \x00 \x0B hunter2 " ,
326
+ b"p\x00 \x00 \x00 \x0b hunter2 " ,
327
327
id = "implied len/type for PasswordMessage" ,
328
328
),
329
329
pytest .param (
330
330
dict (type = pq3 .types .BackendKeyData , payload = dict (pid = 1 , key = 7 )),
331
- b"K\x00 \x00 \x00 \x0C \x00 \x00 \x00 \x01 \x00 \x00 \x00 \x07 " ,
331
+ b"K\x00 \x00 \x00 \x0c \x00 \x00 \x00 \x01 \x00 \x00 \x00 \x07 " ,
332
332
id = "implied len/type for BackendKeyData" ,
333
333
),
334
334
pytest .param (
@@ -338,7 +338,7 @@ def test_Pq3_parse(raw, expected, extra):
338
338
),
339
339
pytest .param (
340
340
dict (type = pq3 .types .ErrorResponse , payload = dict (fields = [b"error" , b"" ])),
341
- b"E\x00 \x00 \x00 \x0B error \x00 \x00 " ,
341
+ b"E\x00 \x00 \x00 \x0b error \x00 \x00 " ,
342
342
id = "implied len/type for ErrorResponse" ,
343
343
),
344
344
pytest .param (
@@ -358,7 +358,7 @@ def test_Pq3_parse(raw, expected, extra):
358
358
),
359
359
pytest .param (
360
360
dict (type = pq3 .types .DataRow , payload = dict (columns = [b"abcd" ])),
361
- b"D\x00 \x00 \x00 \x0E \x00 \x01 \x00 \x00 \x00 \x04 abcd" ,
361
+ b"D\x00 \x00 \x00 \x0e \x00 \x01 \x00 \x00 \x00 \x04 abcd" ,
362
362
id = "implied len/type for DataRow" ,
363
363
),
364
364
pytest .param (
@@ -406,7 +406,7 @@ def test_Pq3_build(fields, expected):
406
406
id = "empty column value" ,
407
407
),
408
408
pytest .param (
409
- b"\x00 \x02 \xFF \xFF \xFF \xFF \xFF \xFF \xFF \xFF " ,
409
+ b"\x00 \x02 \xff \xff \xff \xff \xff \xff \xff \xff " ,
410
410
dict (columns = [None , None ]),
411
411
b"" ,
412
412
id = "null columns" ,
@@ -433,7 +433,7 @@ def test_DataRow_parse(raw, expected, extra):
433
433
),
434
434
pytest .param (
435
435
dict (columns = [None , None ]),
436
- b"\x00 \x02 \xFF \xFF \xFF \xFF \xFF \xFF \xFF \xFF " ,
436
+ b"\x00 \x02 \xff \xff \xff \xff \xff \xff \xff \xff " ,
437
437
id = "null columns" ,
438
438
),
439
439
],
@@ -449,7 +449,7 @@ def test_DataRow_build(fields, expected):
449
449
"raw,expected,exception" ,
450
450
[
451
451
pytest .param (
452
- b"EXTERNAL\x00 \xFF \xFF \xFF \xFF " ,
452
+ b"EXTERNAL\x00 \xff \xff \xff \xff " ,
453
453
dict (name = b"EXTERNAL" , len = - 1 , data = None ),
454
454
None ,
455
455
id = "no initial response" ,
@@ -467,7 +467,7 @@ def test_DataRow_build(fields, expected):
467
467
id = "extra data" ,
468
468
),
469
469
pytest .param (
470
- b"EXTERNAL\x00 \x00 \x00 \x00 \xFF me " ,
470
+ b"EXTERNAL\x00 \x00 \x00 \x00 \xff me " ,
471
471
None ,
472
472
StreamError ,
473
473
id = "underflow" ,
@@ -489,12 +489,12 @@ def test_SASLInitialResponse_parse(raw, expected, exception):
489
489
[
490
490
pytest .param (
491
491
dict (name = b"EXTERNAL" ),
492
- b"EXTERNAL\x00 \xFF \xFF \xFF \xFF " ,
492
+ b"EXTERNAL\x00 \xff \xff \xff \xff " ,
493
493
id = "no initial response" ,
494
494
),
495
495
pytest .param (
496
496
dict (name = b"EXTERNAL" , data = None ),
497
- b"EXTERNAL\x00 \xFF \xFF \xFF \xFF " ,
497
+ b"EXTERNAL\x00 \xff \xff \xff \xff " ,
498
498
id = "no initial response (explicit None)" ,
499
499
),
500
500
pytest .param (
@@ -504,7 +504,7 @@ def test_SASLInitialResponse_parse(raw, expected, exception):
504
504
),
505
505
pytest .param (
506
506
dict (name = b"EXTERNAL" , data = b"me@example.com" ),
507
- b"EXTERNAL\x00 \x00 \x00 \x00 \x0E me @example.com" ,
507
+ b"EXTERNAL\x00 \x00 \x00 \x00 \x0e me @example.com" ,
508
508
id = "initial response" ,
509
509
),
510
510
pytest .param (
@@ -514,7 +514,7 @@ def test_SASLInitialResponse_parse(raw, expected, exception):
514
514
),
515
515
pytest .param (
516
516
dict (name = b"EXTERNAL" , len = 14 , data = b"me" ),
517
- b"EXTERNAL\x00 \x00 \x00 \x00 \x0E me " ,
517
+ b"EXTERNAL\x00 \x00 \x00 \x00 \x0e me " ,
518
518
id = "data underflow" ,
519
519
),
520
520
],
0 commit comments