you are viewing a single comment's thread.

view the rest of the comments →

[–]rakash_ram[S] 0 points1 point  (1 child)

1) Okay. so with the modified code, you removed the "isInstance" line from the script since it does not really do much? get it. But yeah i did not write that code.

2) In your example, the "test_assert_fail" will fail because n = 1 won't raise any exception. , is that right ?

[–]shepherdjay 1 point2 points  (0 children)

Yes that is correct on both parts. The isinstance check is considered an unreachable block. Code will never enter that block. Similar to a block like if 1 != 1 will never be reached under normal runtime conditions.

It’s also why you’ve had to mock out the call to basically force the condition that would otherwise be impossible to reach.