Python-Type-Challenges icon indicating copy to clipboard operation
Python-Type-Challenges copied to clipboard

Support test_code to add pyright-config comment

Open F-park opened this issue 1 year ago • 4 comments

New feature

support test_code to add pyright-config as below.

## End of test code ##
# pyright: analyzeUnannotatedFunctions=false

Bug fix

disable user to modify pyright-config.

F-park avatar Jan 19 '24 16:01 F-park

~~How can I fix the test?~~

I should rewrite the test to make it pass

F-park avatar Jan 19 '24 16:01 F-park

Could you describe what problems you're trying to solve, and what other ways you have considered (if any)? Thanks.

laike9m avatar Jan 19 '24 17:01 laike9m

Could you describe what problems you're trying to solve, and what other ways you have considered (if any)? Thanks.

class MyClass:
    def __init__(self, x: int) -> None:
        self.x = x

    # TODO: Fix the type hints of `copy` to make it type check
    def copy(self):
        copied_object = MyClass(x=self.x)
        return copied_object

It can pass the challenge unexpectedly without return_value annoating


and you said Enabling strict mode would break other challenges in #89, the PR can solve it.

F-park avatar Jan 19 '24 17:01 F-park

Thanks for the PR.

Surely there's value in enabling the configs, however it also brings more complexity. At this point, I don't think it's worth adding it just to fix a tiny problem.

With that said, in the future it might become more useful, so I'll keep this open and re-evaluate when the time comes. Hope you can understand.

laike9m avatar Jan 26 '24 02:01 laike9m