def test_dec2base_places(value, base, places, expected): assert compare_result(expected, binary._dec2base(value, base=base, places=places))
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))
def test_dec2base_errors(value): for base in (2, 8, 16): assert compare_result(value, binary._dec2base(value, base=base))