@@ -42,50 +42,46 @@ def test_get(self):
42
42
43
43
class ResourceInfoTestCase (unittest .TestCase ):
44
44
def test_simple (self ):
45
- info = ResourceInfo ("a" , name = ("foo" , "bar" ), start = 0 , end = 1 , width = 8 )
46
- self .assertEqual (info .name , ("foo" , "bar" ))
45
+ info = ResourceInfo ("a" , path = ("foo" , "bar" ), start = 0 , end = 1 , width = 8 )
46
+ self .assertEqual (info .path , ("foo" , "bar" ))
47
47
self .assertEqual (info .start , 0 )
48
48
self .assertEqual (info .end , 1 )
49
49
self .assertEqual (info .width , 8 )
50
50
51
- def test_name_cast (self ):
52
- info = ResourceInfo ("a" , name = "foo" , start = 0 , end = 1 , width = 8 )
53
- self .assertEqual (info .name , ("foo" ,))
54
-
55
- def test_wrong_name (self ):
51
+ def test_wrong_path (self ):
56
52
with self .assertRaisesRegex (TypeError ,
57
- r"Name must be a non-empty sequence of non-empty strings, not \(1,\)" ):
58
- ResourceInfo ("a" , name = (1 ,), start = 0 , end = 1 , width = 8 )
53
+ r"Path must be a non-empty sequence of non-empty strings, not \(1,\)" ):
54
+ ResourceInfo ("a" , path = (1 ,), start = 0 , end = 1 , width = 8 )
59
55
with self .assertRaisesRegex (TypeError ,
60
- r"Name must be a non-empty sequence of non-empty strings, not \(\)" ):
61
- ResourceInfo ("a" , name = (), start = 0 , end = 1 , width = 8 )
56
+ r"Path must be a non-empty sequence of non-empty strings, not \(\)" ):
57
+ ResourceInfo ("a" , path = (), start = 0 , end = 1 , width = 8 )
62
58
with self .assertRaisesRegex (TypeError ,
63
- r"Name must be a non-empty sequence of non-empty strings, not \('foo', ''\)" ):
64
- ResourceInfo ("a" , name = ("foo" , "" ), start = 0 , end = 1 , width = 8 )
59
+ r"Path must be a non-empty sequence of non-empty strings, not \('foo', ''\)" ):
60
+ ResourceInfo ("a" , path = ("foo" , "" ), start = 0 , end = 1 , width = 8 )
65
61
66
62
def test_wrong_start_addr (self ):
67
63
with self .assertRaisesRegex (TypeError ,
68
64
r"Start address must be a non-negative integer, not 'foo'" ):
69
- ResourceInfo ("a" , name = "b" , start = "foo" , end = 1 , width = 8 )
65
+ ResourceInfo ("a" , path = ( "b" ,) , start = "foo" , end = 1 , width = 8 )
70
66
with self .assertRaisesRegex (TypeError ,
71
67
r"Start address must be a non-negative integer, not -1" ):
72
- ResourceInfo ("a" , name = "b" , start = - 1 , end = 1 , width = 8 )
68
+ ResourceInfo ("a" , path = ( "b" ,) , start = - 1 , end = 1 , width = 8 )
73
69
74
70
def test_wrong_end_addr (self ):
75
71
with self .assertRaisesRegex (TypeError ,
76
72
r"End address must be an integer greater than the start address, not 'foo'" ):
77
- ResourceInfo ("a" , name = "b" , start = 0 , end = "foo" , width = 8 )
73
+ ResourceInfo ("a" , path = ( "b" ,) , start = 0 , end = "foo" , width = 8 )
78
74
with self .assertRaisesRegex (TypeError ,
79
75
r"End address must be an integer greater than the start address, not 0" ):
80
- ResourceInfo ("a" , name = "b" , start = 0 , end = 0 , width = 8 )
76
+ ResourceInfo ("a" , path = ( "b" ,) , start = 0 , end = 0 , width = 8 )
81
77
82
78
def test_wrong_width (self ):
83
79
with self .assertRaisesRegex (TypeError ,
84
80
r"Width must be a non-negative integer, not 'foo'" ):
85
- ResourceInfo ("a" , name = "b" , start = 0 , end = 1 , width = "foo" )
81
+ ResourceInfo ("a" , path = ( "b" ,) , start = 0 , end = 1 , width = "foo" )
86
82
with self .assertRaisesRegex (TypeError ,
87
83
r"Width must be a non-negative integer, not -1" ):
88
- ResourceInfo ("a" , name = "b" , start = 0 , end = 1 , width = - 1 )
84
+ ResourceInfo ("a" , path = ( "b" ,) , start = 0 , end = 1 , width = - 1 )
89
85
90
86
91
87
class MemoryMapTestCase (unittest .TestCase ):
@@ -391,37 +387,37 @@ def test_iter_all_resources(self):
391
387
res_info = list (self .root .all_resources ())
392
388
393
389
self .assertIs (res_info [0 ].resource , self .res1 )
394
- self .assertEqual (res_info [0 ].name , ("name1" ,))
390
+ self .assertEqual (res_info [0 ].path , ("name1" ,))
395
391
self .assertEqual (res_info [0 ].start , 0x00000000 )
396
392
self .assertEqual (res_info [0 ].end , 0x00000010 )
397
393
self .assertEqual (res_info [0 ].width , 32 )
398
394
399
395
self .assertIs (res_info [1 ].resource , self .res2 )
400
- self .assertEqual (res_info [1 ].name , ("name2" ,))
396
+ self .assertEqual (res_info [1 ].path , ("name2" ,))
401
397
self .assertEqual (res_info [1 ].start , 0x00010000 )
402
398
self .assertEqual (res_info [1 ].end , 0x00010020 )
403
399
self .assertEqual (res_info [1 ].width , 32 )
404
400
405
401
self .assertIs (res_info [2 ].resource , self .res3 )
406
- self .assertEqual (res_info [2 ].name , ("name3" ,))
402
+ self .assertEqual (res_info [2 ].path , ("name3" ,))
407
403
self .assertEqual (res_info [2 ].start , 0x00010020 )
408
404
self .assertEqual (res_info [2 ].end , 0x00010040 )
409
405
self .assertEqual (res_info [2 ].width , 32 )
410
406
411
407
self .assertIs (res_info [3 ].resource , self .res4 )
412
- self .assertEqual (res_info [3 ].name , ("name4" ,))
408
+ self .assertEqual (res_info [3 ].path , ("name4" ,))
413
409
self .assertEqual (res_info [3 ].start , 0x00020000 )
414
410
self .assertEqual (res_info [3 ].end , 0x00020001 )
415
411
self .assertEqual (res_info [3 ].width , 32 )
416
412
417
413
self .assertIs (res_info [4 ].resource , self .res5 )
418
- self .assertEqual (res_info [4 ].name , ("name5" ,))
414
+ self .assertEqual (res_info [4 ].path , ("name5" ,))
419
415
self .assertEqual (res_info [4 ].start , 0x00030000 )
420
416
self .assertEqual (res_info [4 ].end , 0x00030010 )
421
417
self .assertEqual (res_info [4 ].width , 8 )
422
418
423
419
self .assertIs (res_info [5 ].resource , self .res6 )
424
- self .assertEqual (res_info [5 ].name , ("win3" , "name6" ))
420
+ self .assertEqual (res_info [5 ].path , ("win3" , "name6" ))
425
421
self .assertEqual (res_info [5 ].start , 0x00040000 )
426
422
self .assertEqual (res_info [5 ].end , 0x00040004 )
427
423
self .assertEqual (res_info [5 ].width , 32 )
@@ -430,7 +426,7 @@ def test_find_resource(self):
430
426
for res_info in self .root .all_resources ():
431
427
other = self .root .find_resource (res_info .resource )
432
428
self .assertIs (other .resource , res_info .resource )
433
- self .assertEqual (other .name , res_info .name )
429
+ self .assertEqual (other .path , res_info .path )
434
430
self .assertEqual (other .start , res_info .start )
435
431
self .assertEqual (other .end , res_info .end )
436
432
self .assertEqual (other .width , res_info .width )
0 commit comments