Skip to content

Commit

Permalink
improved coverage + changed file name of report
Browse files Browse the repository at this point in the history
  • Loading branch information
thekingoflorda committed Jun 27, 2024
1 parent 998fed2 commit 75bf4cd
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion blip.txt

This file was deleted.

1 change: 0 additions & 1 deletion blup.txt

This file was deleted.

1 change: 1 addition & 0 deletions lucCoverageReport.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{500: 1, 501: 1, 502: 1, 503: 2, 504: 2, 505: 4, 506: 4, 507: 2, 508: 1, 509: 0}
6 changes: 3 additions & 3 deletions redbot/core/bank.py
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ async def set_balance(member: Union[discord.Member, discord.User], amount: int)
coverage[506] += 1
await group.name.set(member.display_name)

with open("blup.txt", "w") as file:
with open("lucCoverageReport.txt", "w") as file:
file.write(str(coverage))

return amount
Expand Down Expand Up @@ -405,7 +405,7 @@ async def withdraw_credits(member: discord.Member, amount: int) -> int:
bal = await get_balance(member)
if amount > bal: # 509
coverage[509] += 1
with open("blup.txt", "w") as file:
with open("lucCoverageReport.txt", "w") as file:
file.write(str(coverage))
raise ValueError(
"Insufficient funds {} > {}".format(
Expand All @@ -414,7 +414,7 @@ async def withdraw_credits(member: discord.Member, amount: int) -> int:
)
)

with open("blup.txt", "w") as file:
with open("lucCoverageReport.txt", "w") as file:
file.write(str(coverage))

return await set_balance(member, bal - amount)
Expand Down
4 changes: 4 additions & 0 deletions tests/cogs/test_economy.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,10 @@ async def test_bank_set(bank, member_factory):

with pytest.raises(errors.BalanceTooHigh):
await bank.set_balance(mbr, 2 ** 63)

await bank.set_global(True)
bank.set_balance(mbr, 100)
assert await bank.get_balance(mbr) == 100

async def test_bank_withdraw(bank, member_factory):
mbr = member_factory.get()
Expand Down

0 comments on commit 75bf4cd

Please sign in to comment.