I want to understand what I'm doing here wrong.
from enum import Enum, auto
class colors(Enum):
red= auto()
green= auto()
yellow= auto()
This is my class.
def is_first(self):
return self is not colors.red
My first function.
def second(self):
if self is colors.red:
return ''
elif self is green:
return 'second_type'
elif self is yellow:
return 'third_type'
What am I doing wrong in testing I need to them all pass.
@pytest.mark.parametrize('input_str, expected_result',
[('aa', False)])
def test_is_first(input_str, expected_result):
assert is_first(input_str) is expected_result
and for my second function
@pytest.mark.parametrize('input_str, expected_result',
[('', True),
('second_type', True),
('third_type', 'True'),
('aa', False)])
def test_second(input_str, expected_result):
assert second(input_str) is expected_result
Aucun commentaire:
Enregistrer un commentaire