Backport of #876 - Partial revert of d9fbd270

Reverted the logic change, and updated the tests to correctly fail.
AssertionError exception should not be rethrown, has they can occur during
normal presentation compiler operation.

Fixes #1002355

(cherry picked from commit 1862714813b6b880a0612118f94f97c6a9177712)