affirm
affirm copied to clipboard
On both 2.7.12 and 3.6.0a3, affirm seems to do nothing.
It successfully installs via pip, but there's no change to output of assertions, whether through assert() or affirm().
I'm on OSX 10.9.5, Pythons provided via brew, system, and virtualenv all seem to have same issue.
Interesting. Can you share a sample that shows this? I can't reproduce it here.
Can you also clone the repo and run test.sh
on your system to see if the tests pass?
My test case was basically piping the examples described in the docs to python -c, and running them in default console and Jupyter.
Cloning and running test now!
Tests pass AFAICT.
So, I actually get different results running from file...
- Doing a whole module import, I get "None" as the message value for the assertion rather than variable values
- It works with
from affirm import affirm
Yeah, neither affirm nor assert work without the code being stored in a file. To figure out the original expression, I load the source file and look for it there. So running with python -c
or in interactive mode doesn't work.
import affirm
should work for regular assert statements, let me know if it doesn't work for you.
Also, really nice to hear somebody is using my tiny library, thanks!
Ah, that makes sense of why case 2 works now, but 'import affirm + regular assert' is still reporting None instead of the generated message. I'll poke around some.
Hmmmm. I wonder if it would be possible to fall back to inspecting function args or locals or such? I have up till now done more ruby, so I don't know the details on inspecting bindings at place of execution.
You're very welcome! I'll let you know if I can figure out anything else here.
On Sun, Oct 30, 2016 at 4:13 AM, Eli Finer [email protected] wrote:
Yeah, neither affirm nor assert work without the code being stored in a file. To figure out the original expression, I load the source file and look for it there. So running with python -c or in interactive mode doesn't work.
import affirm should work for regular assert statements, let me know if it doesn't work for you.
Also, really nice to hear somebody is using my tiny library, thanks!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/elifiner/affirm/issues/1#issuecomment-257137999, or mute the thread https://github.com/notifications/unsubscribe-auth/AACD8Iq4E0_DbSx0DFKKhAKbD_dAbEDbks5q5FGkgaJpZM4Kj9Vz .
It's much harder to do it without source being available since you need to parse bytecode. I didn't want to have affirm depend on something like python-meta which can do that but is quite an overkill.
I previously started working on a bytecode parser, but didn't get far enough for it to be useful. I'll take another look, maybe some of it can be integrated into affirm.
On Sun, Oct 30, 2016, 08:17 pobocks [email protected] wrote:
Ah, that makes sense of why case 2 works now, but 'import affirm + regular assert' is still reporting None instead of the generated message. I'll poke around some.
Hmmmm. I wonder if it would be possible to fall back to inspecting function args or locals or such? I have up till now done more ruby, so I don't know the details on inspecting bindings at place of execution.
You're very welcome! I'll let you know if I can figure out anything else here.
On Sun, Oct 30, 2016 at 4:13 AM, Eli Finer [email protected] wrote:
Yeah, neither affirm nor assert work without the code being stored in a file. To figure out the original expression, I load the source file and look for it there. So running with python -c or in interactive mode doesn't work.
import affirm should work for regular assert statements, let me know if it doesn't work for you.
Also, really nice to hear somebody is using my tiny library, thanks!
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/elifiner/affirm/issues/1#issuecomment-257137999, or mute the thread < https://github.com/notifications/unsubscribe-auth/AACD8Iq4E0_DbSx0DFKKhAKbD_dAbEDbks5q5FGkgaJpZM4Kj9Vz
.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/elifiner/affirm/issues/1#issuecomment-257157184, or mute the thread https://github.com/notifications/unsubscribe-auth/AAx2tX8TgT_q8SqgN1d2sd46Tfxlnrpuks5q5LUYgaJpZM4Kj9Vz .