def test(a: only(int)): return a
def test_only(self): self.assertIsInstance(1, only(int)) self.assertNotIsInstance(True, only(int))