mardi 17 mars 2020

python:TypeError: __call__() missing 1 required positional argument: 'value' [closed]

When I try to run the code I am getting the below error, I am not sure how to fix this. Any help is much appreciated, Thanks.

class Numbers(Enum):
NOTHING = auto()
FIRST= auto()
SECOND= auto()
THIRD= auto()

This is my enum class part.

def is_nothing(self):
    return self is not Numbers.NOTHING

My first funtion

def digit(self):
    if self is Numbers.NOTHING:
        return ''
    elif self is Numbers.FIRST:
        return '_first'
    elif self is Numbers.SECOND:
        return '_second'
    elif self is Numbers.THIRD:
        return '_third'

second function

@pytest.mark.parametrize('input_text, expected_result',
                [('something', True),
             ('', False)])

def test_is_nothing(input_text, expected_result):
numbers_obj = Numbers() 
assert numbers_obj .is_nothing(input_text) is expected_result

testing first function

@pytest.mark.parametrize('input_text, expected_result',
                    [('nothing', ''),
        ('first', '_first'),
        ('second', '_second'),
        ('third', '_third')])

def test_digit(input_text, expected_result):
numbers_obj = Numbers() 
assert numbers_obj .digit(input_text) is expected_result

Testing second function. And I got this errors ,so I need them all to get pass. And I got this for all my six lines enter image description here

Aucun commentaire:

Enregistrer un commentaire