# Path: test/converter/_common.py
# EXCEPTION_RESULT = "E"
# 
# def convert_wrapper(typeobj, method):
#     try:
#         return getattr(typeobj, method)()
#     except (typepy.TypeConversionError):
#         return EXCEPTION_RESULT


from decimal import Decimal
from ._common import EXCEPTION_RESULT, convert_wrapper
        from typepy import Nan, StrictLevel
import pytest
import typepy
"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""






nan = float("nan")
inf = float("inf")


class Test_RealNumber:
    @pytest.mark.parametrize(
        ["method", "strict_level", "value", "expected"],
        [
            ["convert", 0, 1, Decimal("1")],
            ["convert", 0, 1.0, Decimal("1.0")],
            ["convert", 0, 1.1, Decimal("1.1")],
            ["convert", 0, "0", Decimal("0")],
            ["convert", 0, "1.0", Decimal("1.0")],
            ["convert", 0, "1.1", Decimal("1.1")],

# Path: test/converter/_common.py
# EXCEPTION_RESULT = "E"
# 
# def convert_wrapper(typeobj, method):
#     try:
#         return getattr(typeobj, method)()
#     except (typepy.TypeConversionError):
#         return EXCEPTION_RESULT


# Path: test/converter/test_realnumber.py
from decimal import Decimal
from ._common import EXCEPTION_RESULT, convert_wrapper
        from typepy import Nan, StrictLevel
import pytest
import typepy

"""
.. codeauthor:: Tsuyoshi Hombashi <tsuyoshi.hombashi@gmail.com>
"""






nan = float("nan")
inf = float("inf")


class Test_RealNumber:
    @pytest.mark.parametrize(
        ["method", "strict_level", "value", "expected"],
        [
            ["convert", 0, 1, Decimal("1")],
            ["convert", 0, 1.0, Decimal("1.0")],
            ["convert", 0, 1.1, Decimal("1.1")],
            ["convert", 0, "0", Decimal("0")],
            ["convert", 0, "1.0", Decimal("1.0")],
            ["convert", 0, "1.1", Decimal("1.1")],

            ["convert", 0, True, EXCEPTION_RESULT],