Skip to content

Commit f17acc7

Browse files
committed
Pep8 formatting
1 parent 5defe91 commit f17acc7

2 files changed

Lines changed: 15 additions & 14 deletions

File tree

server/src/sustainability.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33

44
class VehicleEnum(Enum):
5-
Bus = 'b'
6-
Car = 'c'
7-
Luas = 'l'
8-
Train = 't'
5+
Bus = "b"
6+
Car = "c"
7+
Luas = "l"
8+
Train = "t"
99

1010

1111
def calc_emissions(distance: float, vehicle_type: VehicleEnum) -> float:
@@ -24,13 +24,13 @@ def calc_emissions(distance: float, vehicle_type: VehicleEnum) -> float:
2424

2525
if distance < 0:
2626
return -1
27-
elif vehicle_type == 'b':
27+
elif vehicle_type == "b":
2828
emission_factor = 25
29-
elif vehicle_type == 'c':
29+
elif vehicle_type == "c":
3030
emission_factor = 102
31-
elif vehicle_type == 'l':
31+
elif vehicle_type == "l":
3232
emission_factor = 5
33-
elif vehicle_type == 't':
33+
elif vehicle_type == "t":
3434
emission_factor = 28
3535
else:
3636
return -1

server/tests/test_sustainability.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,29 @@
44

55
# Test Emissions calculating function
66

7+
78
def test_car_calc_emissions():
8-
assert calc_emissions(7, 'c') == 714
9+
assert calc_emissions(7, "c") == 714
910

1011

1112
def test_bus_calc_emissions():
12-
assert calc_emissions(7, 'b') == 175
13+
assert calc_emissions(7, "b") == 175
1314

1415

1516
def test_train_calc_emissions():
16-
assert calc_emissions(7, 't') == 196
17+
assert calc_emissions(7, "t") == 196
1718

1819

1920
def test_luas_calc_emissions():
20-
assert calc_emissions(7, 'l') == 35
21+
assert calc_emissions(7, "l") == 35
2122

2223

2324
def test_invalidDistance_calc_emissions():
24-
assert calc_emissions(-7, 'c') == -1
25+
assert calc_emissions(-7, "c") == -1
2526

2627

2728
def test_invalid_Vehichle_calc_emissions():
28-
assert calc_emissions(7, 'x') == -1
29+
assert calc_emissions(7, "x") == -1
2930

3031

3132
# Test score calculating function

0 commit comments

Comments
 (0)