Fix tests

This commit is contained in:
Ivan Habunek 2024-04-28 10:16:33 +02:00
parent aac450a5bc
commit de95384e6b
No known key found for this signature in database
GPG Key ID: F5F0623FF5EBCB3D

View File

@ -23,26 +23,31 @@ def test_downloaded():
assert progress.progress_perc == 0 assert progress.progress_perc == 0
progress.advance(1, 100) progress.advance(1, 100)
progress._recalculate()
assert progress.downloaded == 100 assert progress.downloaded == 100
assert progress.progress_bytes == 100 assert progress.progress_bytes == 100
assert progress.progress_perc == 11 assert progress.progress_perc == 11
progress.advance(2, 200) progress.advance(2, 200)
progress._recalculate()
assert progress.downloaded == 300 assert progress.downloaded == 300
assert progress.progress_bytes == 300 assert progress.progress_bytes == 300
assert progress.progress_perc == 33 assert progress.progress_perc == 33
progress.advance(3, 150) progress.advance(3, 150)
progress._recalculate()
assert progress.downloaded == 450 assert progress.downloaded == 450
assert progress.progress_bytes == 450 assert progress.progress_bytes == 450
assert progress.progress_perc == 50 assert progress.progress_perc == 50
progress.advance(1, 50) progress.advance(1, 50)
progress._recalculate()
assert progress.downloaded == 500 assert progress.downloaded == 500
assert progress.progress_bytes == 500 assert progress.progress_bytes == 500
assert progress.progress_perc == 55 assert progress.progress_perc == 55
progress.abort(2) progress.abort(2)
progress._recalculate()
assert progress.downloaded == 500 assert progress.downloaded == 500
assert progress.progress_bytes == 300 assert progress.progress_bytes == 300
assert progress.progress_perc == 33 assert progress.progress_perc == 33
@ -52,6 +57,7 @@ def test_downloaded():
progress.advance(1, 150) progress.advance(1, 150)
progress.advance(2, 300) progress.advance(2, 300)
progress.advance(3, 150) progress.advance(3, 150)
progress._recalculate()
assert progress.downloaded == 1100 assert progress.downloaded == 1100
assert progress.progress_bytes == 900 assert progress.progress_bytes == 900
@ -71,12 +77,15 @@ def test_estimated_total():
assert progress.estimated_total is None assert progress.estimated_total is None
progress.start(1, 12000) progress.start(1, 12000)
progress._recalculate()
assert progress.estimated_total == 12000 * 3 assert progress.estimated_total == 12000 * 3
progress.start(2, 11000) progress.start(2, 11000)
progress._recalculate()
assert progress.estimated_total == 11500 * 3 assert progress.estimated_total == 11500 * 3
progress.start(3, 10000) progress.start(3, 10000)
progress._recalculate()
assert progress.estimated_total == 11000 * 3 assert progress.estimated_total == 11000 * 3