+ 8

Asserts are like if?

you compare data and if is right continue and if not(else) raise an exception?

3rd May 2017, 7:04 PM
Guilherme Augusto De Sousa
Guilherme Augusto De Sousa - avatar
7 ответов
+ 19
Kind of. Using assert supports debugging and yes, it works as if you check on a condition being True. If it is False, AssertionError() is raised.
3rd May 2017, 7:16 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 11
Seems like that. Only that there ain’t an “else” statement to execute. Either you go through and execute the next command or you land into an error.
22nd Sep 2018, 11:24 AM
⚡️Pikachu⚡️
⚡️Pikachu⚡️ - avatar
+ 1
Thanks a lot
3rd May 2017, 7:55 PM
Guilherme Augusto De Sousa
Guilherme Augusto De Sousa - avatar
+ 1
Good question!
24th May 2017, 10:01 PM
Tamir Elsahy
Tamir Elsahy - avatar
0
I also had the same doubt!thanks.
26th Nov 2017, 6:56 AM
syedkabir
syedkabir - avatar
0
Use accerts in testing the code ... I have not seen accerts in production code .... some one can correct me if my assumption is wrong
22nd Feb 2018, 2:16 PM
cool
0
What I have seen is that asserts stop completely if anything turns out to be false.
11th Apr 2018, 6:58 PM
Ridwan Abrar
Ridwan Abrar - avatar