Skip to content

Commit

Permalink
Refactor download_state.py and test_download_state.py
Browse files Browse the repository at this point in the history
- Remove the `get_session_ratio` method from `DownloadState` class in download_state.py
- Remove the assertion for `get_session_ratio()` in test_download_state.py
  • Loading branch information
drew2a committed Jan 29, 2024
1 parent dbc502b commit 04dd2c5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,13 +153,6 @@ def total_payload_download(self) -> int:
return 0
return self.lt_status.total_payload_download

def get_session_ratio(self) -> float:
""" Returns the seeding ratio of the download for the current session.
"""
if not self.lt_status or not self.total_payload_download:
return 0
return self.total_payload_upload / self.total_payload_download

def get_all_time_ratio(self) -> float:
""" Returns the accumulated seeding ratio of the download across multiple sessions.
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ def test_getters_setters_2(mock_download, mock_lt_status):

assert download_state.total_payload_upload == 30
assert download_state.total_payload_download == 100
assert download_state.get_session_ratio() == 0.3

assert download_state.all_time_upload == 200
assert download_state.all_time_download == 1000
Expand Down

0 comments on commit 04dd2c5

Please sign in to comment.