Check type of StrEnum value in __str__

Even though StrEnum is an Enum with str mixin, the value is still not
guaranteed to be a str. Verify its type as part of __str__.

Change-Id: Ifdc992ecf320a6f8b07b656d38974e8246a7c9e9
Fuchsia-Auto-Submit: Sam Balana <>
Commit-Queue: Auto-Submit <>
Reviewed-by: Jonathan Chang <>
diff --git a/packages/antlion/ b/packages/antlion/
index 435c68d..24f1a0e 100644
--- a/packages/antlion/
+++ b/packages/antlion/
@@ -22,6 +22,8 @@
 class StrEnum(str, Enum):
     def __str__(self) -> str:
+        if not isinstance(self.value, str):
+            raise TypeError(f"Expected a str, got {type(self.value)}")
         return self.value