Added test_utils.py

This commit is contained in:
Rob McMullen 2017-05-07 09:35:56 -07:00
parent 5fcb646131
commit 1e38dfb516

23
test/test_utils.py Normal file
View File

@ -0,0 +1,23 @@
from mock import *
from atrcopy import utils
class TestTextToInt(object):
def setup(self):
pass
@pytest.mark.parametrize("text,expected,default_base", [
("12", 0x12, "hex"),
("$1234", 0x1234, "hex"),
("0xffff", 0xffff, "hex"),
("#12", 12, "hex"),
("%11001010", 202, "hex"),
("12", 12, "dec"),
("$1234", 0x1234, "dec"),
("0xffff", 0xffff, "dec"),
("#12", 12, "dec"),
("%11001010", 202, "dec"),
])
def test_text_to_int(self, text, expected, default_base):
assert expected == utils.text_to_int(text, default_base)