Fix tests failing
Use an assertion to replace an if statement