Spaces:
Runtime error
Runtime error
Mohammed Thameem commited on
Commit ·
e4b1e43
1
Parent(s): 41ad3f7
WIP before rebase
Browse files- tests/test_app.py +8 -21
tests/test_app.py
CHANGED
|
@@ -3,26 +3,13 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), "..")))
|
|
| 3 |
|
| 4 |
import app
|
| 5 |
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
def test_chat_returns_string():
|
| 14 |
-
"""chat() should return a non-empty string for minimal input."""
|
| 15 |
-
result = app.chat(
|
| 16 |
-
messages="I'm buying a bottle of water.",
|
| 17 |
-
history=[],
|
| 18 |
-
car_km=0,
|
| 19 |
-
bus_km=0,
|
| 20 |
-
train_km=0,
|
| 21 |
-
air_km_month=0,
|
| 22 |
-
meat_meals=0,
|
| 23 |
-
vegetarian_meals=0,
|
| 24 |
-
vegan_meals=0,
|
| 25 |
)
|
| 26 |
|
| 27 |
-
assert
|
| 28 |
-
assert
|
|
|
|
|
|
| 3 |
|
| 4 |
import app
|
| 5 |
|
| 6 |
+
def test_calculate_footprint():
|
| 7 |
+
"""Check CO2 footprint calculation."""
|
| 8 |
+
total, stats = app.calculate_footprint(
|
| 9 |
+
car_km=10, bus_km=5, train_km=2, air_km_week=50,
|
| 10 |
+
meat_meals=3, vegetarian_meals=2, vegan_meals=1,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
)
|
| 12 |
|
| 13 |
+
assert total > 0
|
| 14 |
+
assert "trees" in stats
|
| 15 |
+
assert isinstance(stats["trees"], int)
|