final submission

This commit is contained in:
2021-08-23 20:27:00 -05:00
parent 71fffe1cb6
commit dc0d34cb2e
3 changed files with 96 additions and 29 deletions

View File

@@ -10,12 +10,10 @@ def drive_train():
"""
return BikeDriveTrain([38, 30], [28, 23, 19, 16])
def test_bike_drive_train(drive_train):
assert drive_train.front_cogs == [38, 30]
assert drive_train.rear_cogs == [28, 23, 19, 16]
def test_bike_drive_train_ratios(drive_train):
# generate list of the gear ratios for the given front crank and rear cassette
ratios = [(38, 28, 38 / 28),
@@ -60,9 +58,17 @@ def test_bike_drive_train_shift_seq(drive_train):
(30, 19, 30 / 19)
]
# Test case an downshifting sequence
sequence = drive_train.get_shift_sequence(target_ratio=1.4, initial_gear_combination=[30, 19])
assert sequence == [
(30, 19, 30 / 19),
(38, 19, 38 / 19),
(38, 23, 38 / 23),
(38, 28, 38 / 28),
]
def test_bike_drive_train_shift_seq_output(drive_train, capsys):
drive_train.get_shift_sequence(target_ratio=1.6, initial_gear_combination=[38, 28])
drive_train.produce_formatted_shift_sequence(target_ratio=1.6, initial_gear_combination=[38, 28])
out, err = capsys.readouterr()
assert out == "1 - F:38 R:28 Ratio 1.357\n2 - F:30 R:28 Ratio 1.071\n3 - F:30 R:23 Ratio 1.304\n4 - F:30 R:19 Ratio 1.579"
assert out == "1 - F:38 R:28 Ratio 1.357\n2 - F:30 R:28 Ratio 1.071\n3 - F:30 R:23 Ratio 1.304\n4 - F:30 R:19 Ratio 1.579\n"