Initial build out
This commit is contained in:
parent
f037c50736
commit
29215e2bd2
40 changed files with 2622 additions and 0 deletions
25
tests/test_ipeds_staff.py
Normal file
25
tests/test_ipeds_staff.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
import shutil
|
||||
|
||||
import admin_analytics.config as config
|
||||
from admin_analytics.config import UD_UNITID
|
||||
from admin_analytics.ipeds.staff import load_staff
|
||||
|
||||
|
||||
def test_load_staff_filters_to_ud(db_conn, fixtures_dir, tmp_path):
|
||||
ipeds_dir = tmp_path / "ipeds" / "staff" / "2023"
|
||||
ipeds_dir.mkdir(parents=True)
|
||||
shutil.copy(fixtures_dir / "s2023.csv", ipeds_dir / "s2023.csv")
|
||||
|
||||
original = config.IPEDS_DATA_DIR
|
||||
config.IPEDS_DATA_DIR = tmp_path / "ipeds"
|
||||
try:
|
||||
count = load_staff(db_conn, range(2023, 2024), unitid_filter=UD_UNITID)
|
||||
finally:
|
||||
config.IPEDS_DATA_DIR = original
|
||||
|
||||
assert count == 1
|
||||
row = db_conn.execute(
|
||||
"SELECT total_staff, faculty_total, management_total FROM raw_ipeds_staff WHERE unitid = ?",
|
||||
[UD_UNITID],
|
||||
).fetchone()
|
||||
assert row == (5081, 124, 1271)
|
||||
Loading…
Add table
Add a link
Reference in a new issue