back to SWE-Agent summary
SWE-Agent: imapclient
Failed to run pytests for test tests
Pytest collection failure.
Patch diff
diff --git a/imapclient/imapclient.py b/imapclient/imapclient.py
index 43c0b10..0ccbfa9 100644
--- a/imapclient/imapclient.py
+++ b/imapclient/imapclient.py
@@ -106,7 +106,15 @@ class Quota:
def require_capability(capability):
"""Decorator raising CapabilityError when a capability is not available."""
- pass
+ def decorator(func):
+ @functools.wraps(func)
+ def wrapper(self, *args, **kwargs):
+ if capability not in self.capabilities():
+ raise exceptions.CapabilityError(
+ "{} capability not supported by server".format(capability))
+ return func(self, *args, **kwargs)
+ return wrapper
+ return decorator
class IMAPClient:
"""A connection to the IMAP server specified by *host* is made when
@@ -1143,4 +1151,4 @@ class _dict_bytes_normaliser:
return False
class IMAPlibLoggerAdapter(LoggerAdapter):
- """Adapter preventing IMAP secrets from going to the logging facility."""
\ No newline at end of file
+ """Adapter preventing IMAP secrets from going to the logging facility."""