From d064ab0bffd429382ea4fafeb144784d403848bd Mon Sep 17 00:00:00 2001 From: Ɓukasz 'sil2100' Zemczak Date: Mon, 16 Jan 2017 10:10:41 +0100 Subject: Import patches-unapplied version 2.2.2-0ubuntu1 to ubuntu/zesty-proposed Imported using git-ubuntu import. Changelog parent: 63d399807de30a64456e672063e7c20babf7aadc New changelog entries: * New upstream release (LP: #1651128) - d/patches/fix-auto-update.patch, d/patches/lp1623570-adjust-walinuxagent-service-after-and-wants.patch: - Dropped as changes have been applied upstream - Refreshed debian/patches/disable_import_test.patch --- tests/utils/test_text_util.py | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'tests/utils/test_text_util.py') diff --git a/tests/utils/test_text_util.py b/tests/utils/test_text_util.py index 9ac0707..dc3de85 100644 --- a/tests/utils/test_text_util.py +++ b/tests/utils/test_text_util.py @@ -35,12 +35,31 @@ class TestTextUtil(AgentTestCase): data = ustr(b'\xef\xbb\xbfhehe', encoding='utf-8') data = textutil.remove_bom(data) self.assertNotEquals(0xbb, data[0]) - + + #bom is comprised of a sequence of three bytes and ff length of the input is shorter + # than three bytes, remove_bom should not do anything + data = u"\xa7" + data = textutil.remove_bom(data) + self.assertEquals(data, data[0]) + + data = u"\xa7\xef" + data = textutil.remove_bom(data) + self.assertEquals(u"\xa7", data[0]) + self.assertEquals(u"\xef", data[1]) + #Test string without BOM is not affected data = u"hehe" data = textutil.remove_bom(data) self.assertEquals(u"h", data[0]) + data = u"" + data = textutil.remove_bom(data) + self.assertEquals(u"", data) + + data = u" " + data = textutil.remove_bom(data) + self.assertEquals(u" ", data) + def test_version_compare(self): self.assertTrue(Version("1.0") < Version("1.1")) self.assertTrue(Version("1.9") < Version("1.10")) -- cgit v1.2.3