Move assertDeprecationWarning to increase readability