Reorganize some rank tests into sub-contexts