Beispiel #1
0
def test_idempotence(ints_pair: AlternativeNativeIntsPair) -> None:
    alternative_int, native_int = ints_pair

    alternative, native = (AlternativeInt(alternative_int),
                           NativeInt(native_int))

    assert are_alternative_native_ints_equal(alternative, native)
Beispiel #2
0
def test_no_argument() -> None:
    alternative, native = AlternativeInt(), NativeInt()

    assert are_alternative_native_ints_equal(alternative, native)
Beispiel #3
0
def test_string_with_base(string_with_base: Tuple[str, int]) -> None:
    string, base = string_with_base

    alternative, native = AlternativeInt(string, base), NativeInt(string, base)

    assert are_alternative_native_ints_equal(alternative, native)
Beispiel #4
0
def test_decimal_string(string: str) -> None:
    alternative, native = AlternativeInt(string), NativeInt(string)

    assert are_alternative_native_ints_equal(alternative, native)
def test_invalid_strings(string: str, base: int) -> None:
    with pytest.raises(ValueError):
        AlternativeInt(string, base)
def test_no_argument() -> None:
    result = AlternativeInt()

    assert isinstance(result, AlternativeInt)
    assert not result
def test_string_with_base(string_with_base: Tuple[str, int]) -> None:
    string, base = string_with_base

    result = AlternativeInt(string, base)

    assert isinstance(result, AlternativeInt)
def test_decimal_string(string: str) -> None:
    result = AlternativeInt(string)

    assert isinstance(result, AlternativeInt)