Skip to content

Commit

Permalink
Don't cover some warning cases
Browse files Browse the repository at this point in the history
that shouldn't exist except perhaps at very beginning of a year
  • Loading branch information
zmoon committed Jan 27, 2024
1 parent 4dff631 commit 154eca0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions uscrn/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def get_year_urls(year):
r = requests.get(url)
r.raise_for_status()
fns = re.findall(r">(CRN[a-zA-Z0-9\-_]*\.txt)<", r.text)
if not fns:
if not fns: # pragma: no cover
warnings.warn(f"no USCRN files found for year {year} (url {url})", stacklevel=2)

return (f"{base_url}/{year}/{fn}" for fn in fns)
Expand Down Expand Up @@ -438,8 +438,8 @@ def get_year_urls(year):
data_cols = [c for c in df.columns if c not in non_data_cols]
if dropna:
df = df.dropna(subset=data_cols, how="all").reset_index(drop=True)
if df.empty:
warnings.warn("CRN dataframe empty after dropping missing data rows")
if df.empty: # pragma: no cover
warnings.warn("USCRN dataframe empty after dropping missing data rows")

# Category cols?
if cat:
Expand Down

0 comments on commit 154eca0

Please sign in to comment.