Skip to content

Commit

Permalink
add bg test; dont double test nces
Browse files Browse the repository at this point in the history
  • Loading branch information
knaaptime committed Jan 18, 2024
1 parent da1e66d commit f6ee87e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 34 deletions.
13 changes: 5 additions & 8 deletions geosnap/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ def seda(
remote_path, converters={"sedasch": str, "fips": str}
)
t.sedasch = t.sedasch.str.rjust(12, "0")
except FileNotFoundError:
raise FileNotFoundError(
except FileNotFoundError as e:
raise FileNotFoundError from e(
"Unable to access local or remote SEDA data"
)
elif level == "geodist":
Expand All @@ -240,8 +240,8 @@ def seda(
remote_path, converters={"sedalea": str, "fips": str}
)
t.sedalea = t.sedalea.str.rjust(7, "0")
except FileNotFoundError:
raise FileNotFoundError(
except FileNotFoundError as e:
raise FileNotFoundError from e(
"Unable to access local or remote SEDA data"
)
t.fips = t.fips.str.rjust(2, "0")
Expand All @@ -264,10 +264,7 @@ def nces(self, year=1516, dataset="sabs"):
geopandas.GeoDataFrame
geodataframe of NCES data
"""
if dataset == "school_districts":
selector = "districts"
else:
selector = dataset
selector = "districts" if dataset == "school_districts" else dataset
local_path = pathlib.Path(self.data_dir, "nces", f"{dataset}_{year}.parquet")
remote_path = f"s3://spatial-ucr/nces/{selector}/{dataset}_{year}.parquet"
msg = "Streaming data from S3. Use `geosnap.io.store_nces()` to store the data locally for better performance"
Expand Down
5 changes: 4 additions & 1 deletion geosnap/tests/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,13 @@ def test_nces_sabs():
assert sabs.shape == (75128, 15)


def test_acs():
def test_acs_tract():
acs = io.get_acs(store, fips="11", years=[2018], level="tract")
assert acs.shape == (179, 157)

def test_acs_blockgroup():
acs = io.get_acs(store, fips="11", years=[2018], level="bg")
assert acs.shape == (450, 38)

@pytest.mark.skipif(not LTDB, reason="unable to locate LTDB data")
def test_ltdb_from_boundary():
Expand Down
25 changes: 0 additions & 25 deletions geosnap/tests/test_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,18 @@ def test_data_dir():
loc = datasets.show_data_dir()
assert len(loc) > 5


def test_acs():
df = datasets.acs(year=2012, states=["11"])
assert df.shape == (179, 104)


def test_tracts90():
df = datasets.tracts_1990(states=["11"])
assert df.shape == (192, 164)


def test_tracts00():
df = datasets.tracts_2000(states=["11"])
assert df.shape == (188, 192)


def test_tracts10():
df = datasets.tracts_2010(states=["11"])
assert df.shape == (179, 194)
Expand All @@ -30,25 +26,20 @@ def test_tracts20():
df = datasets.tracts_2020(states=["11"])
assert df.shape == (206, 15)


def test_counties():
assert datasets.counties().shape == (3233, 2)


def test_states():
assert datasets.states().shape == (51, 3)


def test_msas():
df = datasets.msas()
assert df.shape == (939, 4)


def test_msa_defs():
df = datasets.msa_definitions()
assert df.shape == (1916, 13)


def test_codebook():
df = datasets.codebook()
assert df.shape == (194, 12)
Expand All @@ -68,19 +59,3 @@ def test_blocks_2010():
def test_blocks_2020():
df = datasets.blocks_2020(states=['11'])
assert df.shape == (6012, 7)

def test_ejscreen():
df = datasets.ejscreen(states=['11'], year=2019)
assert df.shape==(450, 368)

def test_nces_schools():
d = datasets.nces(dataset='schools', year='1516')
assert d.shape == (102209, 26)

def test_nces_districts():
d = datasets.nces(dataset='school_districts')
assert d.shape == (13352, 18)

def test_nces_sabs():
df = datasets.nces(dataset='sabs')
assert df.shape == (75128, 15)

0 comments on commit f6ee87e

Please sign in to comment.