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

Reintegrate Typeguard #75

Open
Vlek opened this issue May 4, 2022 · 0 comments
Open

Reintegrate Typeguard #75

Vlek opened this issue May 4, 2022 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@Vlek
Copy link
Owner

Vlek commented May 4, 2022

With the typeguard jobs kicked off, the vast majority of our tests fail. This is due to slight type mismatches due to the Pyparsing library having their own types.

I think that the thing that's going to cause the most problems however is going to be the actual Parse method itself as it is now a ParseResults object, which is a List[Any], but in actuality is List[string, int, float, EvaluationResults], e.g. [1, "+", 2.5].

This is going to be a headache and a half to deal with and I am really worried because I have done stuff like check types ahead of time and raise exceptions if types are not what we expect (however, they should always be what we expect and it's impossible to my knowledge to test without mocking the function and having bad returned values). We may be able to get away with a one-liner so that we can still hit 100% code coverage with something like: if not isinstance(var, (type, type)): raise Exception, but I would like to stay away from that sort of thing if possible because I do not know if Black will like it and it's a pretty hacky workaround.

Another way we can insure types is by having a helper static method in our parser that takes input and ensures it's what we're expecting. That would be testable to cause it to throw, allowing us our 100%.

@Vlek Vlek added the bug Something isn't working label May 4, 2022
@Vlek Vlek added this to the 3.0 milestone May 4, 2022
@Vlek Vlek self-assigned this May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant