forked from openlp/openlp
Add requested changes
This commit is contained in:
parent
5045d51df4
commit
a2b86384a7
@ -25,8 +25,8 @@ Functional tests to test the AppLocation class and related methods.
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
from unittest.mock import MagicMock, call, patch
|
from unittest.mock import MagicMock, call, patch
|
||||||
|
|
||||||
from openlp.core.common import (clean_button_text, de_hump, extension_loader, is_macosx, is_linux,
|
from openlp.core.common import clean_button_text, de_hump, extension_loader, is_macosx, is_linux, \
|
||||||
is_win, normalize_str, path_to_module, trace_error_handler)
|
is_win, normalize_str, path_to_module, trace_error_handler
|
||||||
from openlp.core.common.path import Path
|
from openlp.core.common.path import Path
|
||||||
|
|
||||||
|
|
||||||
@ -213,25 +213,25 @@ class TestCommonFunctions(TestCase):
|
|||||||
|
|
||||||
def test_normalize_str_leaves_newlines(self):
|
def test_normalize_str_leaves_newlines(self):
|
||||||
# GIVEN: a string containing newlines
|
# GIVEN: a string containing newlines
|
||||||
str = 'something\nelse'
|
string = 'something\nelse'
|
||||||
# WHEN: normalize is called
|
# WHEN: normalize is called
|
||||||
normalized_string = normalize_str(str)
|
normalized_string = normalize_str(string)
|
||||||
# THEN: string is unchanged
|
# THEN: string is unchanged
|
||||||
assert normalized_string == str
|
assert normalized_string == string
|
||||||
|
|
||||||
def test_normalize_str_removes_null_byte(self):
|
def test_normalize_str_removes_null_byte(self):
|
||||||
# GIVEN: a string containing newlines
|
# GIVEN: a string containing newlines
|
||||||
str = 'somet\x00hing'
|
string = 'somet\x00hing'
|
||||||
# WHEN: normalize is called
|
# WHEN: normalize is called
|
||||||
normalized_string = normalize_str(str)
|
normalized_string = normalize_str(string)
|
||||||
# THEN: string is unchanged
|
# THEN: string is unchanged
|
||||||
assert normalized_string == 'something'
|
assert normalized_string == 'something'
|
||||||
|
|
||||||
def test_normalize_str_replaces_crlf_with_lf(self):
|
def test_normalize_str_replaces_crlf_with_lf(self):
|
||||||
# GIVEN: a string containing crlf
|
# GIVEN: a string containing crlf
|
||||||
str = 'something\r\nelse'
|
string = 'something\r\nelse'
|
||||||
# WHEN: normalize is called
|
# WHEN: normalize is called
|
||||||
normalized_string = normalize_str(str)
|
normalized_string = normalize_str(string)
|
||||||
# THEN: crlf is replaced with lf
|
# THEN: crlf is replaced with lf
|
||||||
assert normalized_string == 'something\nelse'
|
assert normalized_string == 'something\nelse'
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user