diff --git a/thrift/lib/py3/test/auto_migrate/enums.py b/thrift/lib/py3/test/auto_migrate/enums.py index cf97f04ebde..4d09f3aeb2a 100644 --- a/thrift/lib/py3/test/auto_migrate/enums.py +++ b/thrift/lib/py3/test/auto_migrate/enums.py @@ -50,6 +50,7 @@ def test_normal_enum(self) -> None: self.assertNotEqual(x.type, Kind.SOCK) self.assertIn(x.type, Kind) self.assertEqual(int(x.type), 4) + self.assertRaises(ValueError, lambda: Kind(47)) def test_normal_enum_not_int(self) -> None: x = File(name="/etc", type=Kind.DIR) diff --git a/thrift/lib/python/test/enums.py b/thrift/lib/python/test/enums.py index a467182933a..849889bf57b 100644 --- a/thrift/lib/python/test/enums.py +++ b/thrift/lib/python/test/enums.py @@ -109,6 +109,7 @@ def test_normal_enum(self) -> None: self.assertIsInstance(self.Kind.DIR, int, "Enums are Ints") self.assertIn(x.type, self.Kind) self.assertEqual(x.type.value, 4) + self.assertRaises(ValueError, lambda: self.Kind(47)) def test_enum_value_rename(self) -> None: """The value name is None but we auto rename it to None_"""