Unittest assertion error and encoding

1.7k views Asked by At

I'm trying to write a simple test for my flask app. The app is in cyrillic.

def test_empty(self):
    res = self.app.get('/')
    assert 'В базе нет ссылок.' in res.data

When I try to run this test, I get

FAIL: test_empty (__main__.LinkTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "tests.py", line 17, in test_empty
    assert 'ðÆ ð▒ð░ðÀðÁ ð¢ðÁÐé ÐüÐüÐïð╗ð¥ð║.' in res.data
AssertionError

Seems like there's a problem with encoding.

Could someone please explain me the nature of this problem?

I'm using python 2.7.3 on Windows 7.

0

There are 0 answers