diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index a322d5f..12fbbe1 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -56,9 +56,10 @@ class TestProtocol(enum.Enum):
raise MesonException('unknown test format {}'.format(string))
def __str__(self) -> str:
- if self is self.EXITCODE:
+ cls = type(self)
+ if self is cls.EXITCODE:
return 'exitcode'
- elif self is self.GTEST:
+ elif self is cls.GTEST:
return 'gtest'
return 'tap'