Skip to content

Commit 0369bc2

Browse files
committed
Type value for about_resource/about_resource_path should be list
Signed-off-by: Chin Yeung Li <[email protected]>
1 parent d3ad120 commit 0369bc2

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/attributecode/gen.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,19 +235,17 @@ def generate(location, base_dir, license_notice_text_location=None,
235235
try:
236236
# Generate value for 'about_resource' if it does not exist
237237
if not about.about_resource.value:
238-
about.about_resource.value = OrderedDict()
239238
if about.about_file_path.endswith('/'):
240-
about.about_resource.value[u'.'] = None
239+
about.about_resource.value.append(u'.')
241240
about.about_resource.original_value = u'.'
242241
else:
243-
about.about_resource.value[posixpath.basename(about.about_file_path)] = None
242+
about.about_resource.value.append(posixpath.basename(about.about_file_path))
244243
about.about_resource.original_value = posixpath.basename(about.about_file_path)
245244
about.about_resource.present = True
246245

247246
# Generate value for 'about_resource_path' if it does not exist
248247
# Basically, this should be the same as the 'about_resource'
249248
if not about.about_resource_path.value:
250-
about.about_resource_path.value = OrderedDict()
251249
about.about_resource_path.value = about.about_resource.value
252250
about.about_resource_path.present = True
253251

tests/test_gen.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -111,20 +111,18 @@ def test_generation_with_no_about_resource(self):
111111
location = get_test_loc('gen/inv2.csv')
112112
base_dir = get_temp_dir()
113113
errors, abouts = gen.generate(location, base_dir)
114-
expected_dict = OrderedDict()
115-
expected_dict[u'.'] = None
116-
assert abouts[0].about_resource.value == expected_dict
114+
expected = [u'.']
115+
assert abouts[0].about_resource.value == expected
117116
assert len(errors) == 0
118117

119118
def test_generation_with_no_about_resource_reference(self):
120119
location = get_test_loc('gen/inv3.csv')
121120
base_dir = get_temp_dir()
122121

123122
errors, abouts = gen.generate(location, base_dir)
124-
expected_dict = OrderedDict()
125-
expected_dict[u'test.tar.gz'] = None
123+
expected = [u'test.tar.gz']
126124

127-
assert abouts[0].about_resource.value == expected_dict
125+
assert abouts[0].about_resource.value == expected
128126
assert len(errors) == 1
129127
msg = u'The reference file'
130128
assert msg in errors[0].message

0 commit comments

Comments
 (0)