Skip to content

Commit

Permalink
Issue #50: unicode (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Lehmann committed Jan 5, 2018
1 parent dc541d0 commit 91c4b44
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
3 changes: 2 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ Welcome to spline's documentation!
docker_image
hooks
event_logging
options
options
unicode
16 changes: 16 additions & 0 deletions docs/unicode.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Unicode
=======
Unicode is not a trivial topic at all.

Even more it can be pretty tricky writing code that
does work under multiple Python versions especially
when focusing on Python 2.x and Python 3.x.

The reason why I have been investigating into that topic
is that I found a build process where a tool has generated
console output with unicode characters.

In the example you will find a special-characters.yaml.
I tested it for Python 2.7.x and Python 3.5.x on my machine.

Let's see ...
8 changes: 8 additions & 0 deletions tests/test_bash.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# -*- coding: utf-8 -*-
"""Testing of class Bash."""
# pylint: disable=no-self-use, invalid-name, too-many-public-methods
import os
Expand Down Expand Up @@ -110,3 +111,10 @@ def test_dry_run(self):
assert_that(len(output), equal_to(2))
assert_that(output[0], equal_to('''#!/bin/bash'''))
assert_that(output[1], equal_to('''echo "hello"'''))

def test_unicode(self):
"""Tesing unicode character."""
bash = Bash(ShellConfig(script=u'''echo "©"'''))
output = [line for line in bash.process() if len(line) > 0]
assert_that(len(output), equal_to(1))
assert_that(output[0], equal_to(u"©"))

0 comments on commit 91c4b44

Please sign in to comment.