Remove native text converter (#38)

* Remove `native text` converter

This was only necessary with Python 2. After Python 2 removal, both
functions `to_ntext` and `to_utext` exactly did the same.

modified:   ssh-audit.py
modified:   test/test_utils.py

* Rename `to_utext` to `to_text`

... as in Python 3 there is only text (and bytes).

modified:   ssh-audit.py
modified:   test/test_utils.py
This commit is contained in:
Jürgen Gmach
2020-06-17 04:50:07 +02:00
committed by GitHub
parent ec1dda8d7f
commit 12f811cb5c
2 changed files with 10 additions and 26 deletions

View File

@ -14,19 +14,12 @@ class TestUtils:
with pytest.raises(TypeError):
self.utils.to_bytes(123)
def test_to_utext(self):
assert self.utils.to_utext(b'fran\xc3\xa7ais') == 'fran\xe7ais'
assert self.utils.to_utext('fran\xe7ais') == 'fran\xe7ais'
def test_to_text(self):
assert self.utils.to_text(b'fran\xc3\xa7ais') == 'fran\xe7ais'
assert self.utils.to_text('fran\xe7ais') == 'fran\xe7ais'
# other
with pytest.raises(TypeError):
self.utils.to_utext(123)
def test_to_ntext(self):
assert self.utils.to_ntext('fran\xc3\xa7ais') == 'fran\xc3\xa7ais'
assert self.utils.to_ntext(b'fran\xc3\xa7ais') == 'fran\xe7ais'
# other
with pytest.raises(TypeError):
self.utils.to_ntext(123)
self.utils.to_text(123)
def test_is_ascii(self):
assert self.utils.is_ascii('francais') is True