Closed jamessan closed 2 years ago
Guess I didn't need to force a failure to see how this looks. Python 2 tests are failing and probably have been since they were added:
def test_invalid_utf8(vim):
vim.command('normal "=printf("%c", 0xFF)\np')
assert vim.eval("char2nr(getline(1))") == 0xFF
if IS_PYTHON3:
assert vim.current.buffer[:] == ['\udcff']
else:
> assert vim.current.buffer[:] == ['\xff']
E AssertionError: assert [''] == ['\xff']
E At index 0 diff: u'' != '\xff'
E Full diff:
E - [u'']
E + ['\xff']
Note that assert 1 == 2 if 0 else 3
does not fail, but only assert 1 == (2 if 0 else 3)
..!?
Distinct branches are good for code coverage though anyway.
I'm not sure what the correct behavior is supposed to be for Py2. @Shougo or @bfredl, can you advise?
the correct default behaviour in python2 should be no decoding, i e get the raw '\xFF'
byte out (and no unicode
string)
the correct default behaviour in python2 should be no decoding
Maybe you can push the right changes to my branch? I'm not familiar with the pynvim APIs.
Closing in favor of #492, which rips out the py2 code, thus getting rid of the bug.
pytest isn't able to report the expected value when using the
X if Y else Z
syntax.See pytest-dev/pytest#7727