def test_encode_local_ascii_fails(self): with assert_raises(UnicodeDecodeError): with mock.patch.object( sys, 'getfilesystemencoding', return_value='ascii'): encode_local(u'日本語')
def test_encode_local_unicode(self, _): assert_equal(encode_local(b'foo'), u'foo') assert_equal(encode_local(u'foo'), u'foo')
def test_encode_local_empty(self, _): assert_equal(encode_local(b'foo'), u'foo')
def test_encode_local_unicode(_): assert encode_local(b'foo') == u('foo') assert encode_local(u('foo')) == u('foo')
def test_encode_local_ascii(self, _): assert_equal(encode_local(u'foo'), b'foo')
def test_encode_local_ascii_fails(_): with pytest.raises(UnicodeDecodeError): encode_local(u('日本語'))
def test_encode_local_empty(_): assert encode_local(b'foo') == u('foo')
def test_encode_local_ascii(_): assert encode_local(u('foo')) == b'foo'