Skip to content

Automatic Test#18383 - #29

Merged
beltoforion merged 2 commits into
masterfrom
David.Liu/AutomaticTest#18383
May 12, 2025
Merged

beltoforion merged 2 commits into
masterfrom
David.Liu/AutomaticTest#18383

Conversation

@MPIDavidLiu

@MPIDavidLiu MPIDavidLiu commented May 8, 2025 •

Copy link
Copy Markdown
Contributor

Return of low level remote command can't parses

@MPIDavidLiu MPIDavidLiu self-assigned this May 8, 2025
@MPIDavidLiu MPIDavidLiu changed the title Support low level command. Automatic Test#18383 May 8, 2025

@HocaChen HocaChen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I download the branch and test with 3 types of commands
*IDN?
*LOCAL
move_chuck_xy
it can work as expected

Response.check_resp(self.comm.read_line())


def send_cmd(self, cmd: str) -> Response:

@beltoforion beltoforion May 8, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please always return a response object.

  • When we send a SENTIO remote command we have a response object anyway.
  • When we send a "*IDN?" create a new response object, and set the response as the "message()" return
  • When we send a low level command, that does not have a response create a response object on the fly and assign an empty string to the message.

Here is my reasoning:
Your modification is perfectly fine and technically correct but it breaks the "principle of least suprise". When using a send_cmd function that can return different types I have to know in advance which type i will receive. If i do not know the type the client would need to add a type checks on their side whenever send_cmd is used. If i dont do this i will get runtime errors. In addition a python type checker running on client code would mark code that does not actually do the type checking as an error.

The only way to avoid runtime errors or errors from the python type checker in your version would be to check which type is returned whenever send_cmd is used. The easiest way to avoid that and allow clients to write code that works regardless of the type of command sent is to always return a SENTIO response object.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have already fixed the modification.
Please assist with the confirmation again.

@beltoforion
beltoforion merged commit cb88e25 into master May 12, 2025
@IngoBergATV
IngoBergATV deleted the David.Liu/AutomaticTest#18383 branch September 21, 2026 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants