Skip to content

Commit a31ac83

Browse files
committed
Handle cases where keys in the mapping list contains spaces.
1 parent 8450c37 commit a31ac83

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

about_code_tool/genabout.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,12 @@ def get_mapping_list():
111111
with open(join(self_path, 'MAPPING.CONFIG'), "rU") as file_in:
112112
for line in file_in.readlines():
113113
if not line.startswith('#') and ':' in line:
114-
about_spec_key =line.partition(':')[0]
114+
about_spec_key = line.partition(':')[0]
115115
user_spec_key = line.partition(':')[2].strip()
116+
# Handle cases which keys contain spaces
117+
if about_spec_key.endswith(' '):
118+
about_spec_key = about_spec_key.strip()
119+
about_spec_key = about_spec_key.replace(' ', '_')
116120
mapping_list[about_spec_key.lower()] = user_spec_key.lower()
117121
except Exception as e:
118122
print(repr(e))

about_code_tool/tests/test_genabout.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ def test_get_non_empty_rows_list(self):
5858
output = gen.get_non_empty_rows_list(input_list)
5959
self.assertEquals(output, expected_list)
6060

61-
6261
def test_get_mapping_list(self):
6362
gen = genabout.GenAbout()
6463
expected_list = {'about_file': 'directory/filename',

0 commit comments

Comments
 (0)