1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
|
from __future__ import unicode_literals
from ezsnmp.utils import strip_non_printable, tostr
def test_strip_non_printable_regular():
assert strip_non_printable("hello there") == "hello there"
def test_strip_non_printable_contains_binary():
assert strip_non_printable((chr(20)) + "my thingo" + (chr(155))) == (
"my thingo (contains binary)"
)
def test_strip_non_printable_only_binary():
assert strip_non_printable((chr(20)) + (chr(155))) == ("(contains binary)")
def test_tostr_none():
assert tostr(None) is None
def test_tostr_string():
assert tostr("hello there") == "hello there"
def test_tostr_integer():
assert tostr(1234) == "1234"
|