Skip to content
This repository has been archived by the owner on Jan 25, 2024. It is now read-only.

Use casts to improve type checking for MockConsole #322

Open
trickeydan opened this issue Jun 26, 2019 · 1 comment
Open

Use casts to improve type checking for MockConsole #322

trickeydan opened this issue Jun 26, 2019 · 1 comment
Labels
good first issue Good for newcomers testing Test coverage. typing A incorrect or loose type that needs correcting.
Milestone

Comments

@trickeydan
Copy link
Contributor

I'm guessing type: ignore is needed here because the typechecker doesn't know that backend._console is a MockConsole rather than the more general Console. Could we instead pull out the console into a local variable using a cast and refer to it directly?

console = cast(MockConsole, backend._console)
console.expects = ...

Even better, could we refactor so that the console object is created in this function and passed into the ArduinoUnoConsoleBackend constructor, rather than being created inside the constructor and having to be pulled out of a private attribute?

Originally posted by @kierdavis in https://github.com/j5api/j5/pull/306/files

@trickeydan trickeydan added good first issue Good for newcomers testing Test coverage. typing A incorrect or loose type that needs correcting. labels Jun 26, 2019
@trickeydan trickeydan added this to the 1.0.0 milestone Aug 7, 2019
@trickeydan
Copy link
Contributor Author

Relevant: #404

@trickeydan trickeydan modified the milestones: Pre-1.0.0, Post 1.0.0 Jul 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
good first issue Good for newcomers testing Test coverage. typing A incorrect or loose type that needs correcting.
Projects
None yet
Development

No branches or pull requests

1 participant