Nit: I would save the common part of expected_tabs as a variable that can be reused (lines 361-366). That would make it more obvious what was being tested.