CLN: Refactor test_internals and test_multilevel