Skip to content

Commit b370492

Browse files
committed
Fixed #97
Convert all the keys to lower case so that it will not ignore 'Copyright', 'License' etc.
1 parent 4e55fe3 commit b370492

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

about_code_tool/genabout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def get_duplicated_keys(input_file):
7979
@staticmethod
8080
def get_input_list(input_file):
8181
csvfile = csv.DictReader(open(input_file, 'rU'))
82-
return [line for line in csvfile]
82+
return [{k.lower(): v for k, v in r.iteritems()} for r in csvfile]
8383

8484
@staticmethod
8585
def get_non_empty_rows_list(input_list):

about_code_tool/tests/test_genabout.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,14 @@ def test_get_input_list(self):
3939
list = gen.get_input_list(test_input)
4040
self.assertTrue(list == expected_list)
4141

42+
def test_get_input_list_covert_all_keys_to_lower(self):
43+
gen = genabout.GenAbout()
44+
test_input = join(TESTDATA_PATH, "test_files_for_genabout/about_key_with_upper_case.csv")
45+
expected_list = [{'about_file': 'about.ABOUT', 'about_resource': '.',
46+
'name': 'ABOUT tool', 'version': '0.8.1'}]
47+
list = gen.get_input_list(test_input)
48+
self.assertTrue(list == expected_list)
49+
4250
def test_get_non_empty_rows_list(self):
4351
gen = genabout.GenAbout()
4452
input_list = [{'about_file': '/about.ABOUT', 'about_resource': '.',
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
about_file,about_resource,nAme,Version
2+
about.ABOUT,.,ABOUT tool,0.8.1

0 commit comments

Comments
 (0)