Revert "use assert_warns"

This reverts commit d7fe60f14b9a1ca7aef6233673bc5d35c90cbd65.