teyit icon indicating copy to clipboard operation
teyit copied to clipboard

Rewrite `assert` statements, refs #12

Open sobolevn opened this issue 3 years ago • 1 comments

This is still a WIP.

I have several questions:

  1. How does get_arg_offset suppose to work? I am bit a lost with this approach 🙂
  2. Do we need to handle msg part of assert expr, msg? Because not all self.assert*() methods support it

Closes #12

sobolevn avatar Feb 28 '22 18:02 sobolevn

How does get_arg_offset suppose to work? I am bit a lost with this approach

Yeah, it is not a very straight forward solution. But basically it is for adjusting comments appropriately when the initial version of the same call (e.g assertTrue(a < 10, msg="x") has 2 arguments) has more/less arguments than the refactored version (e.g assertLessEquali(a, 10, msg="x") has 3 arguments).

I don't think it is something that this refactor should worry about. Perhaps try returning 0?

Do we need to handle msg part of assert expr, msg? Because not all self.assert*() methods support it

I guess it serves the same purpose, so we can use it. I don't think we need to add it in this PR.

isidentical avatar Mar 01 '22 14:03 isidentical