Fix some linting issues

This commit is contained in:
Raoul Snyman 2014-10-31 22:12:06 +02:00
parent 6a67a77240
commit ee7fb49e49
2 changed files with 6 additions and 3 deletions

View File

@ -232,14 +232,16 @@ def qmd5_hash(salt, data):
log.debug('qmd5_hash() returning "%s"' % hash_value)
return decode(hash_value.data(), 'ascii')
def clean_button_text(button_text):
"""
Clean the & and other characters out of button text
:param button_text: The text to clean
"""
return button_text.replace('&', '').replace('< ', '').replace(' >', '')
from .openlpmixin import OpenLPMixin
from .registry import Registry
from .registrymixin import RegistryMixin

View File

@ -196,9 +196,10 @@ class TestCommonFunctions(TestCase):
# GIVEN: Button text
input_text = '&Next >'
expected_text = 'Next'
# WHEN: The button caption is sent through the clean_button_text function
actual_text = clean_button_text(input_text)
# THEN: The text should have been cleaned
self.assertEqual(expected_text, actual_text, 'The text should be clean')