fix: broken assertion

This commit is contained in:
gmega 2025-01-06 17:01:04 -03:00
parent 59dcba5282
commit 48a1d1a458
No known key found for this signature in database
GPG Key ID: 6290D34EAD824B18
1 changed files with 7 additions and 2 deletions

View File

@ -44,8 +44,13 @@ class MockNode(Node[MockHandle, str]):
return MockDownloadHandle(self)
def remove(self, handle: MockHandle):
assert self.seeding is not None
assert self.leeching == handle or self.seeding[0] == handle
if self.leeching is not None:
assert self.leeching == handle
elif self.seeding is not None:
assert self.seeding[0] == handle
else:
raise Exception('Either leech or seed must be called before attempting a remove')
self.remove_was_called = True