Pull requests

#1 Merged
Repository
msabramo msabramo
Branch
issue-9
Repository
ianb ianb
Branch
default

Fix issue 9: Add test for scripttest.backwardscompat.string

Author
  1. Marc Abramowitz
Reviewers
Description

Fix for https://bitbucket.org/ianb/scripttest/issue/9/ ("Add test for scripttest.backwardscompat.string")

Comments (5)

  1. Marc Abramowitz author
    $ python -V
    Python 2.7
    
    $ nosetests -s -v tests/test_string.py 
    tests.test_string.skip_test_if_not_python_2 ... ok
    tests.test_string.skip_test_if_not_python_3 ... SKIP
    tests.test_string.test_python_2_string_with_ascii_str ... ok
    tests.test_string.test_python_2_string_with_utf8_str ... ok
    tests.test_string.test_python_2_string_with_ascii_unicode ... ok
    tests.test_string.test_python_2_string_with_utf8_unicode ... ERROR
    tests.test_string.test_python_3_string_with_ascii_bytes ... SKIP
    tests.test_string.test_python_3_string_with_utf8_bytes ... SKIP
    tests.test_string.test_python_3_string_with_ascii_str ... SKIP
    tests.test_string.test_python_3_string_with_utf8_str ... SKIP
    
    ======================================================================
    ERROR: tests.test_string.test_python_2_string_with_utf8_unicode
    ----------------------------------------------------------------------
    Traceback (most recent call last):
      File "/Users/marc/python/virtualenvs/pip-python2/lib/python2.7/site-packages/nose/case.py", line 197, in runTest
        self.test(*self.arg)
      File "/Users/marc/dev/hg-repos/scripttest/tests/test_string.py", line 79, in test_python_2_string_with_utf8_unicode
        result = string(utf8_unicode)
      File "/Users/marc/dev/hg-repos/scripttest/scripttest/backwardscompat.py", line 9, in string
        return string.decode('utf-8')
      File "/Users/marc/python/virtualenvs/pip-python2/lib/python2.7/encodings/utf_8.py", line 16, in decode
        return codecs.utf_8_decode(input, errors, True)
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xf6' in position 2: ordinal not in range(128)
    
    ----------------------------------------------------------------------
    Ran 10 tests in 0.178s
    
    FAILED (SKIP=5, errors=1)
    
    $ python -V
    Python 3.2.2
    
    $ nosetests -s -v tests/test_string.py 
    tests.test_string.skip_test_if_not_python_2 ... SKIP
    tests.test_string.skip_test_if_not_python_3 ... ok
    tests.test_string.test_python_2_string_with_ascii_str ... SKIP
    tests.test_string.test_python_2_string_with_utf8_str ... SKIP
    tests.test_string.test_python_2_string_with_ascii_unicode ... SKIP
    tests.test_string.test_python_2_string_with_utf8_unicode ... SKIP
    tests.test_string.test_python_3_string_with_ascii_bytes ... ok
    tests.test_string.test_python_3_string_with_utf8_bytes ... ok
    tests.test_string.test_python_3_string_with_ascii_str ... ok
    tests.test_string.test_python_3_string_with_utf8_str ... ok
    
    ----------------------------------------------------------------------
    Ran 10 tests in 0.013s
    
    OK (SKIP=5)
    
    1. Ian Bicking repo owner

      Oops, I spaced on the failures comment here. Did you have a plan here related to the failure? I don't understand what specifically you are testing with "string(utf8_unicode)"