def test_field2lines_with_string_with_newlines(self): from ZPublisher.Converters import field2lines to_convert = 'abc\ndef\nghi' expected = [b'abc', b'def', b'ghi'] self.assertEqual(field2lines(to_convert), expected)
def test_field2lines_with_tuple(self): from ZPublisher.Converters import field2lines to_convert = ('one', b'two') expected = [b'one', b'two'] self.assertEqual(field2lines(to_convert), expected)
def test_field2lines_with_empty_string(self): from ZPublisher.Converters import field2lines to_convert = '' self.assertEqual(field2lines(to_convert), [])
def test_field2lines_with_string_with_newlines(self): from ZPublisher.Converters import field2lines to_convert = 'abc\ndef\nghi' self.assertEqual(field2lines(to_convert), to_convert.splitlines())
def test_field2lines_with_string_no_newlines(self): from ZPublisher.Converters import field2lines to_convert = 'abc def ghi' self.assertEqual(field2lines(to_convert), [to_convert])
def test_field2lines_with_tuple(self): from ZPublisher.Converters import field2lines to_convert = ('one', 'two') self.assertEqual(field2lines(to_convert), list(to_convert))
def test_field2lines_with_list(self): from ZPublisher.Converters import field2lines to_convert = ['one', 'two'] self.assertEqual(field2lines(to_convert), to_convert)