from typing import Dict


def smallint_func(x: str, _: Dict) -> bool:
    """Tests if the string is a valid smallint"""
    if x == "":
        return True
    x = x.rstrip("0").rstrip(".")
    try:
        y = int(x)
        assert -32768 <= y <= 32767
        return True
    except:  # noqa
        return False