@@ -381,19 +381,19 @@ def test_pack_unpack(self):
381
381
)
382
382
383
383
def test_parse_args (self ):
384
- parsed_args , _ , _ = parse_args (["-b" , "250000" ])
384
+ parsed_args , _ , _ , _ = parse_args (["-b" , "250000" ])
385
385
self .assertEqual (parsed_args .bitrate , 250000 )
386
386
387
- parsed_args , _ , _ = parse_args (["--bitrate" , "500000" ])
387
+ parsed_args , _ , _ , _ = parse_args (["--bitrate" , "500000" ])
388
388
self .assertEqual (parsed_args .bitrate , 500000 )
389
389
390
- parsed_args , _ , _ = parse_args (["-c" , "can0" ])
390
+ parsed_args , _ , _ , _ = parse_args (["-c" , "can0" ])
391
391
self .assertEqual (parsed_args .channel , "can0" )
392
392
393
- parsed_args , _ , _ = parse_args (["--channel" , "PCAN_USBBUS1" ])
393
+ parsed_args , _ , _ , _ = parse_args (["--channel" , "PCAN_USBBUS1" ])
394
394
self .assertEqual (parsed_args .channel , "PCAN_USBBUS1" )
395
395
396
- parsed_args , _ , data_structs = parse_args (["-d" , "100:<L" ])
396
+ parsed_args , _ , data_structs , _ = parse_args (["-d" , "100:<L" ])
397
397
self .assertEqual (parsed_args .decode , ["100:<L" ])
398
398
399
399
self .assertIsInstance (data_structs , dict )
@@ -406,7 +406,7 @@ def test_parse_args(self):
406
406
f = open ("test.txt" , "w" )
407
407
f .write ("100:<BB\n 101:<HH\n " )
408
408
f .close ()
409
- parsed_args , _ , data_structs = parse_args (["-d" , "test.txt" ])
409
+ parsed_args , _ , data_structs , _ = parse_args (["-d" , "test.txt" ])
410
410
411
411
self .assertIsInstance (data_structs , dict )
412
412
self .assertEqual (len (data_structs ), 2 )
@@ -420,7 +420,7 @@ def test_parse_args(self):
420
420
self .assertEqual (data_structs [0x101 ].size , 4 )
421
421
os .remove ("test.txt" )
422
422
423
- parsed_args , _ , data_structs = parse_args (
423
+ parsed_args , _ , data_structs , _ = parse_args (
424
424
["--decode" , "100:<LH:10.:100." , "101:<ff" , "102:<Bf:1:57.3" ]
425
425
)
426
426
self .assertEqual (
@@ -453,14 +453,14 @@ def test_parse_args(self):
453
453
self .assertEqual (data_structs [0x102 ][1 ], 1 )
454
454
self .assertAlmostEqual (data_structs [0x102 ][2 ], 57.3 )
455
455
456
- parsed_args , can_filters , _ = parse_args (["-f" , "100:7FF" ])
456
+ parsed_args , can_filters , _ , _ = parse_args (["-f" , "100:7FF" ])
457
457
self .assertEqual (parsed_args .filter , ["100:7FF" ])
458
458
self .assertIsInstance (can_filters , list )
459
459
self .assertIsInstance (can_filters [0 ], dict )
460
460
self .assertEqual (can_filters [0 ]["can_id" ], 0x100 )
461
461
self .assertEqual (can_filters [0 ]["can_mask" ], 0x7FF )
462
462
463
- parsed_args , can_filters , _ = parse_args (["-f" , "101:7FF" , "102:7FC" ])
463
+ parsed_args , can_filters , _ , _ = parse_args (["-f" , "101:7FF" , "102:7FC" ])
464
464
self .assertEqual (parsed_args .filter , ["101:7FF" , "102:7FC" ])
465
465
self .assertIsInstance (can_filters , list )
466
466
self .assertIsInstance (can_filters [0 ], dict )
@@ -473,17 +473,17 @@ def test_parse_args(self):
473
473
with self .assertRaises (argparse .ArgumentError ):
474
474
parse_args (["-f" , "101,7FF" ])
475
475
476
- parsed_args , can_filters , _ = parse_args (["--filter" , "100~7FF" ])
476
+ parsed_args , can_filters , _ , _ = parse_args (["--filter" , "100~7FF" ])
477
477
self .assertEqual (parsed_args .filter , ["100~7FF" ])
478
478
self .assertIsInstance (can_filters , list )
479
479
self .assertIsInstance (can_filters [0 ], dict )
480
480
self .assertEqual (can_filters [0 ]["can_id" ], 0x100 | 0x20000000 )
481
481
self .assertEqual (can_filters [0 ]["can_mask" ], 0x7FF & 0x20000000 )
482
482
483
- parsed_args , _ , _ = parse_args (["-i" , "socketcan" ])
483
+ parsed_args , _ , _ , _ = parse_args (["-i" , "socketcan" ])
484
484
self .assertEqual (parsed_args .interface , "socketcan" )
485
485
486
- parsed_args , _ , _ = parse_args (["--interface" , "pcan" ])
486
+ parsed_args , _ , _ , _ = parse_args (["--interface" , "pcan" ])
487
487
self .assertEqual (parsed_args .interface , "pcan" )
488
488
489
489
# Make sure it exits with the correct error code when displaying the help page
0 commit comments