Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set5 #7

Open
rohit20032003 opened this issue Jun 28, 2024 · 0 comments
Open

set5 #7

rohit20032003 opened this issue Jun 28, 2024 · 0 comments

Comments

@rohit20032003
Copy link

test_fuel
correct code
import pytest
from fuel import convert, gauge

Test cases for convert function

def test_convert_valid_fraction():
assert convert("3/4") == 75

def test_convert_zero_division_error():
with pytest.raises(ZeroDivisionError):
convert("1/0")

def test_convert_value_error():
with pytest.raises(ValueError):
convert("2.5/3")

def test_convert_x_greater_than_y():
with pytest.raises(ValueError):
convert("5/3")

Test cases for gauge function

def test_gauge_less_than_1():
assert gauge(1) == "E"
assert gauge(0) == "E"

def test_gauge_greater_than_99():
assert gauge(99) == "F"
assert gauge(100) == "F"

def test_gauge_between_1_and_99():
assert gauge(50) == "50%"
assert gauge(75) == "75%"

Additional test cases as needed

Run the tests with pytest

if name == "main":
pytest.main()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant