Skip to content

Commit 2d1069d

Browse files
Copilotpolybassa
authored andcommitted
Fix syntax errors in CBOR unit tests by adding blank lines before assertions
Co-authored-by: polybassa <1676055+polybassa@users.noreply.github.com>
1 parent 748787b commit 2d1069d

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

test/scapy/layers/cbor.uts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -926,6 +926,7 @@ for _ in range(20):
926926
success_count += 1
927927
except:
928928
pass
929+
929930
success_count >= 18
930931

931932
= Random nested arrays encode/decode correctly
@@ -951,38 +952,43 @@ from scapy.cbor import RandCBORObject
951952
rand = RandCBORObject()
952953
objects = []
953954
for _ in range(100):
955+
obj = None
954956
try:
955957
obj = rand._fix()
956-
objects.append(obj)
957958
except:
958959
pass
960+
if obj is not None:
961+
objects.append(obj)
962+
959963
len(objects) >= 95
960964

961965
= Encode 50 random objects without errors
962966
from scapy.cbor import RandCBORObject
963967
rand = RandCBORObject()
964968
encoded_count = 0
965969
for _ in range(50):
970+
obj = rand._fix()
966971
try:
967-
obj = rand._fix()
968972
encoded = bytes(obj)
969973
if len(encoded) > 0:
970974
encoded_count += 1
971975
except:
972976
pass
977+
973978
encoded_count >= 45
974979

975980
= Roundtrip 50 random objects
976981
from scapy.cbor import RandCBORObject, CBOR_Codecs
977982
rand = RandCBORObject()
978983
roundtrip_count = 0
979984
for _ in range(50):
985+
obj = rand._fix()
980986
try:
981-
obj = rand._fix()
982987
encoded = bytes(obj)
983988
decoded, remainder = CBOR_Codecs.CBOR.dec(encoded)
984989
if remainder == b'':
985990
roundtrip_count += 1
986991
except:
987992
pass
993+
988994
roundtrip_count >= 45

0 commit comments

Comments
 (0)