# SPDX-License-Identifier: MIT
# Independently authored numeric warning and slot-result conformance case.
import warnings
class Value:
    def __init__(self, mode): self.mode = mode
    def __int__(self):
        if self.mode == 0: return 7
        if self.mode == 1: return True
        return 1.5
with warnings.catch_warnings(record=True) as caught:
    warnings.simplefilter("always")
    for mode in range(3):
        try:
            result = int(Value(mode))
            print(type(result).__name__, result)
        except TypeError as error:
            print(str(error))
    print(len(caught), caught[0].category.__name__)
    print(str(caught[0].message))
with warnings.catch_warnings(record=True):
    warnings.simplefilter("error")
    try:
        int(Value(1))
    except DeprecationWarning as error:
        print(type(error).__name__)
