Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enrique #24

Merged
merged 19 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add ddb mapping test, move tests to directory, run pytest in action
  • Loading branch information
moldhouse committed Sep 21, 2021
commit 0c678e34a54a8fbe1072ccfae71ee5a9f02b91d1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ jobs:
with:
python-version: 3.8

- name: Run assert pk
run: python assert_pk.py
- name: Run tests
run: pytest

14 changes: 0 additions & 14 deletions assert_pk.py

This file was deleted.

18 changes: 18 additions & 0 deletions tests/test_ogn_ddb_mapping.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import csv
import json

def test_ogn_ddb_mapping():
with open("gliderlist.csv") as file:
reader = csv.reader(file, delimiter=",")
next(reader)
gliders = {int(row[0]): row[1:] for row in reader}

with open("ogn_ddb_mapping.json") as file:
ogn_mapping = json.load(file)
for v in ogn_mapping.values():
if v:
assert gliders.get(v["id"]) is not None, v


if __name__ == "__main__":
test_ogn_ddb_mapping()
21 changes: 21 additions & 0 deletions tests/test_unique_pk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import csv


def test_unique_pk():
with open("gliderlist.csv") as file:
reader = csv.reader(file, delimiter=",")
next(reader)
pks = [row[0] for row in reader]
assert len(pks) == len(set(pks))


def test_unique_name():
with open("gliderlist.csv") as file:
reader = csv.reader(file, delimiter=",")
next(reader)
pks = [row[2] for row in reader]
assert len(pks) == len(set(pks))


if __name__ == "__main__":
test_unique_pk()