コード例 #1
0
 def test_includes_div_incl_for_all_fli_and_urms_who_are_not_in_any_other_dept(self):
     students = pd.DataFrame({
         'hopkins_id': ['pmle45', 'fjr84', '9f8j39'],
         'college': ['wse', 'wse', 'ksas'],
         'school_year': ['Sophomore', 'Junior', 'Senior'],
         'is_athlete': [False, False, False],
         'is_urm': [True, False, False],
         'is_first_generation': [False, True, False],
         'is_pell_eligible': [False, False, True],
         'is_pre_med': [False, False, False],
         'major_department': ['elec_eng', 'english', 'science'],
         'is_in_org': [False, False, False],
         'is_ep': [False, False, False],
         'wgs_affiliation_type': [None, None, None]
     })
     expected = pd.DataFrame({
         'hopkins_id': ['pmle45', 'pmle45', 'fjr84', 'fjr84', '9f8j39', '9f8j39'],
         'department': ['elec_eng', Departments.SOAR_DIV_INCL.value.name,
                        'english', Departments.SOAR_DIV_INCL.value.name,
                        'science', Departments.SOAR_DIV_INCL.value.name, ]
     })
     actual = pd.concat([make_student_department_subtable(students, 'pmle45'),
                         make_student_department_subtable(students, 'fjr84'),
                         make_student_department_subtable(students, '9f8j39')]).reset_index(drop=True)
     assert_frame_equal(expected, actual)
コード例 #2
0
 def test_does_not_include_div_incl_for_non_undergrads(self):
     students = pd.DataFrame({
         'hopkins_id': ['pmle45', 'fjr84', '9f8j39'],
         'college': ['wse', 'wse', 'ksas'],
         'school_year': ['Masters', 'Doctorate', 'Postdoctoral Studies'],
         'is_athlete': [False, False, False],
         'is_urm': [True, False, False],
         'is_first_generation': [False, True, False],
         'is_pell_eligible': [False, False, True],
         'is_pre_med': [False, False, False],
         'major_department': ['elec_eng', 'english', 'science'],
         'is_in_org': [False, False, False],
         'is_ep': [False, False, False],
         'wgs_affiliation_type': [None, None, None]
     })
     expected = pd.DataFrame({
         'hopkins_id': ['pmle45', 'fjr84', '9f8j39'],
         'department': ['elec_eng', 'english', 'science']
     })
     actual = pd.concat([make_student_department_subtable(students, 'pmle45'),
                         make_student_department_subtable(students, 'fjr84'),
                         make_student_department_subtable(students, '9f8j39')]).reset_index(drop=True)
     assert_frame_equal(expected, actual)
コード例 #3
0
 def test_adds_wgs_dept_for_students_enrolled_in_or_minoring_in_wgs(self):
     students = pd.DataFrame({
         'hopkins_id': ['93aml3', 'f89423'],
         'college': ['ksas', 'ksas'],
         'school_year': ['Junior', 'Senior'],
         'is_athlete': [False, False],
         'is_urm': [False, False],
         'is_first_generation': [False, False],
         'is_pell_eligible': [False, False],
         'major_department': ['humanities', 'humanities'],
         'is_in_org': [False, False],
         'is_ep': [False, False],
         'wgs_affiliation_type': ['enrollment', 'minor']
     })
     expected1 = pd.DataFrame({
         'hopkins_id': ['93aml3', '93aml3'],
         'department': ['humanities', Departments.WGS.value.name]
     })
     assert_frame_equal(expected1, make_student_department_subtable(students, '93aml3'))
     expected2 = pd.DataFrame({
         'hopkins_id': ['f89423', 'f89423'],
         'department': ['humanities', Departments.WGS.value.name]
     })
     assert_frame_equal(expected2, make_student_department_subtable(students, 'f89423'))
コード例 #4
0
 def test_includes_soar_sli_department_for_students_in_student_orgs(self):
     students = pd.DataFrame({
         'hopkins_id': ['jf398f'],
         'college': ['wse'],
         'school_year': ['Sophomore'],
         'is_athlete': [False],
         'is_urm': [False],
         'is_first_generation': [False],
         'is_pell_eligible': [False],
         'major_department': ['comp_sci'],
         'is_in_org': [True],
         'is_ep': [False],
         'wgs_affiliation_type': [None]
     })
     expected = pd.DataFrame({
         'hopkins_id': ['jf398f', 'jf398f'],
         'department': ['comp_sci', Departments.SOAR_SLI.value.name]
     })
     assert_frame_equal(expected, make_student_department_subtable(students, 'jf398f'))
コード例 #5
0
 def test_does_not_ignore_major_dept_for_wse_freshmen_if_freshman_is_bme(self):
     students = pd.DataFrame({
         'hopkins_id': ['93aml3'],
         'college': ['wse'],
         'school_year': ['Freshman'],
         'is_athlete': [False],
         'is_urm': [False],
         'is_first_generation': [False],
         'is_pell_eligible': [False],
         'major_department': ['bme'],
         'is_in_org': [False],
         'is_ep': [False],
         'wgs_affiliation_type': [None]
     })
     expected = pd.DataFrame({
         'hopkins_id': ['93aml3', '93aml3'],
         'department': ['bme', Departments.SOAR_FYE_WSE.value.name]
     })
     assert_frame_equal(expected, make_student_department_subtable(students, '93aml3'))
コード例 #6
0
 def test_only_includes_soar_fye_ksas_department_once_for_ksas_freshmen_who_have_not_chosen_a_major(self):
     students = pd.DataFrame({
         'hopkins_id': ['93aml3'],
         'college': ['ksas'],
         'school_year': ['Freshman'],
         'is_athlete': [False],
         'is_urm': [False],
         'is_first_generation': [False],
         'is_pell_eligible': [False],
         'major_department': [Departments.SOAR_FYE_KSAS.value.name],
         'is_in_org': [False],
         'is_ep': [False],
         'wgs_affiliation_type': [None]
     })
     expected = pd.DataFrame({
         'hopkins_id': ['93aml3'],
         'department': [Departments.SOAR_FYE_KSAS.value.name]
     })
     assert_frame_equal(expected, make_student_department_subtable(students, '93aml3'))
コード例 #7
0
 def test_makes_a_dataframe_mapping_hopkins_id_to_academic_departments_if_student_doesnt_fall_into_any_soar_departments(self):
     students = pd.DataFrame({
         'hopkins_id': ['jf38ru', 'jf38ru', 'kf034i'],
         'college': ['ksas', 'wse', 'ksas'],
         'school_year': ['Senior', 'Senior', 'Junior'],
         'is_athlete': [False, False, False],
         'is_urm': [False, False, False],
         'is_first_generation': [False, False, False],
         'is_pell_eligible': [False, False, False],
         'major_department': ['pol_sci_econ', 'comp_elec_eng', 'pol_sci_econ'],
         'is_in_org': [False, False, False],
         'is_ep': [False, False, False],
         'wgs_affiliation_type': [None, None, None]
     })
     expected = pd.DataFrame({
         'hopkins_id': ['jf38ru', 'jf38ru'],
         'department': ['pol_sci_econ', 'comp_elec_eng']
     })
     assert_frame_equal(expected, make_student_department_subtable(students, 'jf38ru'))
コード例 #8
0
 def test_makes_an_empty_dataframe_if_the_given_hopkins_id_does_not_appear_in_the_students_table(self):
     students = pd.DataFrame({
         'hopkins_id': [],
         'college': [],
         'school_year': [],
         'is_athlete': [],
         'is_urm': [],
         'is_first_generation': [],
         'is_pell_eligible': [],
         'major_department': [],
         'is_in_org': [],
         'is_ep': [],
         'wgs_affiliation_type': []
     })
     expected = pd.DataFrame({
         'hopkins_id': [],
         'department': []
     })
     assert_frame_equal(expected, make_student_department_subtable(students, 'invalid id'))
コード例 #9
0
 def test_includes_css_department_for_pre_med_fli_urms(self):
     students = pd.DataFrame({
         'hopkins_id': ['pmle45'],
         'college': ['wse'],
         'school_year': ['Sophomore'],
         'is_athlete': [False],
         'is_urm': [True],
         'is_first_generation': [False],
         'is_pell_eligible': [True],
         'is_pre_med': [True],
         'major_department': ['elec_eng'],
         'is_in_org': [False],
         'is_ep': [False],
         'wgs_affiliation_type': [None]
     })
     expected = pd.DataFrame({
         'hopkins_id': ['pmle45', 'pmle45'],
         'department': ['elec_eng', Departments.SOAR_CSS.value.name]
     })
     assert_frame_equal(expected, make_student_department_subtable(students, 'pmle45'))
コード例 #10
0
 def test_does_not_include_soar_diversity_and_inclusion_department_is_urm_is_nan(self):
     students = pd.DataFrame({
         'hopkins_id': ['pmle45'],
         'college': ['wse'],
         'school_year': ['Sophomore'],
         'is_athlete': [False],
         'is_urm': [np.nan],
         'is_first_generation': [False],
         'is_pell_eligible': [False],
         'is_pre_med': [False],
         'major_department': ['elec_eng'],
         'is_in_org': [False],
         'is_ep': [False],
         'wgs_affiliation_type': [None]
     })
     expected = pd.DataFrame({
         'hopkins_id': ['pmle45'],
         'department': ['elec_eng']
     })
     assert_frame_equal(expected, make_student_department_subtable(students, 'pmle45'))
コード例 #11
0
 def test_includes_multiple_soar_departments_as_appropriate(self):
     students = pd.DataFrame({
         'hopkins_id': ['pmle45', 'pmle45'],
         'college': ['wse', 'ksas'],
         'school_year': ['Freshman', 'Freshman'],
         'is_athlete': [True, True],
         'is_urm': [True, True],
         'is_first_generation': [False, False],
         'is_pell_eligible': [False, False],
         'is_pre_med': [False, False],
         'major_department': ['elec_eng', Departments.SOAR_FYE_KSAS.value.name],
         'is_in_org': [False, False],
         'is_ep': [False, False],
         'wgs_affiliation_type': [None, None]
     })
     expected = pd.DataFrame({
         'hopkins_id': ['pmle45', 'pmle45', 'pmle45'],
         'department': [
             Departments.SOAR_ATHLETICS.value.name,
             Departments.SOAR_FYE_KSAS.value.name,
             Departments.SOAR_FYE_WSE.value.name]
     })
     assert_frame_equal(expected, make_student_department_subtable(students, 'pmle45'))