'Utility for checking that our test student comes up as assigned to the
specified partition (or, if None, no partition at all)'

def assert_student_in_group(self, group, partition=None):

    self.assertEqual(CohortPartitionScheme.get_group_for_user(self.course_key, self.student, (partition or self.user_partition), use_cached=False), group)
