diff --git a/src/ape/managers/accounts.py b/src/ape/managers/accounts.py index 860925710f..3c2630eab4 100644 --- a/src/ape/managers/accounts.py +++ b/src/ape/managers/accounts.py @@ -82,13 +82,12 @@ def __getitem__(self, account_id): @__getitem__.register def __getitem_int(self, account_id: int): - if account_id in self._accounts_by_index: - return self._accounts_by_index[account_id] - - original_account_id = account_id if account_id < 0: account_id = len(self) + account_id + if account_id in self._accounts_by_index: + return self._accounts_by_index[account_id] + account = self.containers["test"].get_test_account(account_id) self._accounts_by_index[original_account_id] = account return account