Skip to content

Commit daa925f

Browse files
committed
#406 - Update the test template
* The test didn't pass on Python3 because python3 doesn't convert the dict.values() to list and causing the error. Updated the test code.
1 parent cc61d27 commit daa925f

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

src/attributecode/attrib.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,6 @@ def generate(abouts, template=None, variables=None):
7474
if about.license_file:
7575
# We want to create a dictionary which have the license short name as
7676
# the key and license text as the value
77-
print("##################################################")
78-
print(about.license_file)
7977
for license_text_name in about.license_file.value:
8078
if not license_text_name in captured_license:
8179
captured_license.append(license_text_name)
@@ -86,8 +84,6 @@ def generate(abouts, template=None, variables=None):
8684
license_key_and_context[license_key] = about.license_file.value[license_text_name]
8785
sorted_license_key_and_context = collections.OrderedDict(sorted(license_key_and_context.items()))
8886
license_file_name_and_key[license_text_name] = license_key
89-
print("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! LIC KEY AND CONTEXT")
90-
print(license_key_and_context)
9187

9288
# Convert/map the key in license expression to license name
9389
if about.license_expression.value and about.license_name.value:
@@ -121,8 +117,6 @@ def generate(abouts, template=None, variables=None):
121117

122118
# Get the current UTC time
123119
utcnow = datetime.datetime.utcnow()
124-
print("$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ BEFORE Render")
125-
print(license_key_and_context)
126120
rendered = template.render(
127121
abouts=abouts, common_licenses=COMMON_LICENSES,
128122
license_key_and_context=sorted_license_key_and_context,

tests/test_attrib.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,6 @@ def test_lic_key_name_sync(self):
124124
f2 = '\n'.join(ef.readlines(False))
125125

126126
assert f1 == f2
127-
assert 1 == 2
128127

129128
def remove_timestamp(html_text):
130129
"""

tests/testdata/test_attrib/gen_license_key_name_check/custom.template

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
<div class="oss-component" id="component_{{ loop.index0 }}">
1515
{% for i in range(about_object.license_file.value|length) %}
1616
<h2>{{ about_object.license_key.value[i] | e}}</h2>
17-
<pre>{{ about_object.license_file.value.values()[i] | e}}</pre>
17+
{% set lic_text = about_object.license_file.value.values() | list %}
18+
<pre>{{ lic_text[i] | e }}</pre>
1819
{% endfor %}
1920

2021
</div>

tests/testdata/test_attrib/gen_license_key_name_check/expected/expected.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
<div class="oss-component" id="component_0">
1515

1616
<h2>Apache-2.0</h2>
17+
1718
<pre>This is Apache</pre>
1819

1920
<h2>LGPL-3.0-or-later</h2>
21+
2022
<pre>This is LGPL</pre>
2123

2224

0 commit comments

Comments
 (0)