Exemplo n.º 1
0
def test_dec2base_places(value, base, places, expected):
    assert compare_result(expected,
                          binary._dec2base(value, base=base, places=places))
Exemplo n.º 2
0
def test_dec2base(value, base, expected):
    assert compare_result(expected, binary._dec2base(value, base=base))

    mapped = {2: binary.dec2bin, 8: binary.dec2oct, 16: binary.dec2hex}
    assert compare_result(expected, mapped[base](value))
Exemplo n.º 3
0
def test_dec2base_errors(value):
    for base in (2, 8, 16):
        assert compare_result(value, binary._dec2base(value, base=base))
Exemplo n.º 4
0
def test_dec2base_places(value, base, places, expected):
    assert compare_result(expected,
                          binary._dec2base(value, base=base, places=places))
Exemplo n.º 5
0
def test_dec2base(value, base, expected):
    assert compare_result(expected, binary._dec2base(value, base=base))

    mapped = {2: binary.dec2bin, 8: binary.dec2oct, 16: binary.dec2hex}
    assert compare_result(expected, mapped[base](value))
Exemplo n.º 6
0
def test_dec2base_errors(value):
    for base in (2, 8, 16):
        assert compare_result(value, binary._dec2base(value, base=base))