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

error() is not printing the value of the variable when assert expression only contains that variable #1

Open
vzakaznikov opened this issue Jun 16, 2023 · 0 comments

Comments

@vzakaznikov
Copy link
Collaborator

with Module("regression"):
    with Scenario("my test"):
        with Check("my check"):
            value = False
            result = snapshot(value,id="my_test",name="my_check")
            assert result, error()

produces the following output where the value of the result is not printed.

Jun 16,2023 8:03:36       ⟥  Check my check
                42ms       ⟥    Exception: Traceback (most recent call last):
                                    File "/home/user/Projects/Altinity/training/davit/using_snapshots/test.py", line 9, in <module>
                                      assert result, error()
                                  AssertionError: Oops! Assertion failed

                                  The following assertion was not satisfied
                                    assert result, error()

                                  Assertion values
                                    assert result, error()
                                    ^ is False

                                  Where
                                    File '/home/user/Projects/Altinity/training/davit/using_snapshots/test.py', line 9 in '<module>'

                                   1|  from testflows.core import *
                                   2|  from testflows.asserts import snapshot, values, error
                                   3|  
                                   4|  with Module("regression"):
                                   5|      with Scenario("my test"):
                                   6|          with Check("my check"):
                                   7|              value = False
                                   8|              result = snapshot(value,id="my_test",name="my_check")
                                   9|>             assert result, error()
                                  10|  
                                  11|

instead we want to see output similar to

                         Assertion values
                           assert result and True, error()
                                  ^ is SnapshotError(
                           filename=/home/user/Projects/Altinity/training/davit/using_snapshots/snapshots/test.py.my_test.snapshot
                           name=my_check
                           snapshot_value="""
                               True""",
                           actual_value="""
                               False""",
                           diff="""
                               --- /home/user/Projects/Altinity/training/davit/using_snapshots/snapshots/test.py.my_test.snapshot
                               +++ 
                               @@ -1 +1 @@
                               -True
                               +False
                           """)
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

No branches or pull requests

1 participant