Skip to content

Commit

Permalink
Move datasets to assets (#44)
Browse files Browse the repository at this point in the history
  • Loading branch information
LSYS committed Apr 1, 2024
1 parent 9b08ef6 commit 4fd3a01
Show file tree
Hide file tree
Showing 59 changed files with 16 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ test: ## Run tests with pytest and coverage
@rm -rf temp
make clean-dta
# Git checkout census.dta
git checkout datasets/census.dta
git checkout assets/datasets/census.dta

.PHONY: lint
MYPY_OPTS := --ignore-missing-imports
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added assets/datasets/census.dta
Binary file not shown.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file removed datasets/census.dta
Binary file not shown.
28 changes: 15 additions & 13 deletions tests/test_wbstata.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
)


DATAPATH = "assets/datasets"

def test_normalize_dta_filename():
expected = "census.dta"

Expand All @@ -25,13 +27,13 @@ def test_normalize_dta_filename():
result = normalize_dta_filename(filename)
assert result == expected

expected = "datasets/census.dta"
expected = f"{DATAPATH}/census.dta"

filename = "datasets/census"
filename = f"{DATAPATH}/census"
result = normalize_dta_filename(filename)
assert result == expected

filename = "datasets/census.dta"
filename = f"{DATAPATH}/census.dta"
result = normalize_dta_filename(filename)
assert result == expected

Expand All @@ -56,7 +58,7 @@ def test_add_suffix():


def test_get_output_name():
file = "census.dta"
file = f"{DATAPATH}/census.dta"

# Overwriting
expected = file
Expand All @@ -83,7 +85,7 @@ def test_get_output_name():


def test_is_dta_file():
valid_file = "datasets/census.dta"
valid_file = f"{DATAPATH}/census.dta"
is_dta_file(valid_file)

invalid_file = "wrongfile.dta"
Expand All @@ -108,8 +110,8 @@ def test_glob_dta_files():
def test_convert_dta():
for version in range(10, 17 + 1):
convert_dta(
"datasets/census.dta",
"datasets/test-output.dta",
f"{DATAPATH}/census.dta",
f"{DATAPATH}/test-output.dta",
target_version=version,
)

Expand All @@ -135,13 +137,13 @@ def test_wbstata():
)

# Check that prompt works with just file (prompt for version)
result = runner.invoke(wbstata, ["datasets/census.dta"])
result = runner.invoke(wbstata, [f"{DATAPATH}/census.dta"])
assert result.exit_code == 0
assert "> Target version" in result.output

# Check minimal command
dta = "datasets/census.dta"
expected_output = f"{dta} to datasets/census-wbstata.dta in version 13.\n"
dta = f"{DATAPATH}/census.dta"
expected_output = f"{dta} to {DATAPATH}/census-wbstata.dta in version 13.\n"
result = runner.invoke(
wbstata, [f"{dta}", "--target-version", "13", "--verbose"]
)
Expand All @@ -150,9 +152,9 @@ def test_wbstata():
assert COMPLETION_MSG in result.output

# Check multiple
dta1 = "datasets/census.dta"
dta2 = "datasets/auto.dta"
dta3 = "datasets/lifeexp.dta"
dta1 = f"{DATAPATH}/census.dta"
dta2 = f"{DATAPATH}/auto.dta"
dta3 = f"{DATAPATH}/lifeexp.dta"
result = runner.invoke(
wbstata,
[
Expand Down

0 comments on commit 4fd3a01

Please sign in to comment.