File: test_utils.py

package info (click to toggle)
python-ezsnmp 1.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 11,256 kB
  • sloc: cpp: 3,746; python: 1,987; javascript: 1,110; makefile: 17; sh: 12
file content (29 lines) | stat: -rw-r--r-- 685 bytes parent folder | download
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"