Refresh unit test assertions for hard removals in Python 3.12. Change-Id: I80f64a47f81dc0314823cd6df6283a0c0603a387