-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Setup CI infrastructure for automated tests
- Loading branch information
Showing
4 changed files
with
75 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Tests | ||
|
||
on: [push, pull_request] | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.8", "3.9", "3.10"] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest jupyter | ||
- name: Install the bdikit package | ||
run: | | ||
pip install -e . | ||
- name: Test with pytest | ||
run: | | ||
pytest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
all: test | ||
|
||
PHONY: test | ||
|
||
test: | ||
python3 -m pytest |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import unittest | ||
import pandas as pd | ||
from bdikit.mapping_algorithms.column_mapping.algorithms import ( | ||
SimFloodAlgorithm, | ||
JaccardDistanceAlgorithm, | ||
DistributionBasedAlgorithm, | ||
ComaAlgorithm, | ||
CupidAlgorithm, | ||
) | ||
|
||
|
||
class ColumnMappingTest(unittest.TestCase): | ||
def test_basic_column_mapping_algorithms(self): | ||
for ColumnMatcher in [ | ||
SimFloodAlgorithm, | ||
JaccardDistanceAlgorithm, | ||
DistributionBasedAlgorithm, | ||
ComaAlgorithm, | ||
CupidAlgorithm, | ||
]: | ||
# given | ||
table1 = pd.DataFrame( | ||
{"column_1": ["a1", "b1", "c1"], "col_2": ["a2", "b2", "c2"]} | ||
) | ||
table2 = pd.DataFrame( | ||
{"column_1a": ["a1", "b1", "c1"], "col2": ["a2", "b2", "c2"]} | ||
) | ||
column_matcher = ColumnMatcher(dataset=table1, global_table=table2) | ||
|
||
# when | ||
mapping = column_matcher.map() | ||
|
||
# then | ||
print(mapping) | ||
self.assertEqual( | ||
{"column_1": "column_1a", "col_2": "col2"}, | ||
mapping, | ||
msg=f"{ColumnMatcher.__name__} failed to map columns", | ||
) |