Commit ba94a0ba by Jörg Stucke

whitespace bugfix

parent 5d77c76b
......@@ -133,10 +133,10 @@ def _count_this_mitigation(summary, mitigation):
def software_components(software_string):
software = software_string
software = software_string.strip()
ver_number = ''
if ' ' in software_string:
split_software_string = software_string.split(' ')
if ' ' in software:
split_software_string = software.split(' ')
if len(split_software_string) > 2:
software, ver_number = _larger_two_components(split_software_string)
elif len(split_software_string[1]) > 0:
......
......@@ -2,7 +2,7 @@ from pathlib import Path
import pytest
from pdf_generator.tex_generation.template_engine import (
TemplateEngine, decode_base64_to_file, render_number_as_size, render_unix_time,
software_components, TemplateEngine, decode_base64_to_file, render_number_as_size, render_unix_time,
replace_special_characters, get_five_longest_entries
)
......@@ -56,3 +56,15 @@ def test_get_five_longest_entries():
longest_dict = get_five_longest_entries(TEST_DICT['file_type']['summary'], top=1)
assert len(longest_dict) == 1
assert 'compression/zlib' in longest_dict.keys()
@pytest.mark.parametrize('test_input, expected_output', [
('FOO 1.0', '1.0}{FOO'),
('1.0 FOO', '1.0}{FOO'),
('FOO BAR 1.0', '1.0}{FOOBAR'),
('FOO', '}{FOO'),
(' FOO ', '}{FOO'),
(' FOO BAR 1.0 ', '1.0}{FOOBAR'),
])
def test_software_components(test_input, expected_output):
assert software_components(test_input) == expected_output
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment