Skip to content

Commit

Permalink
Fix Issue #13 (#14)
Browse files Browse the repository at this point in the history
* Fix #13.

* Fix run-test for C++ coverage.
  • Loading branch information
tohtsky authored Jun 30, 2022
1 parent cbe8b70 commit 6b2c6d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ jobs:
pip install --upgrade pip
pip install numpy scipy pandas
sudo apt-get install lcov
CXXFLAGS="-O0 -g -coverage" pip install -e .
FLAGS="-fprofile-arcs -ftest-coverage"
CFLAGS="$FLAGS" CXXFLAGS="$FLAGS" pip install -e .
- name: Run pytest
run: |
pip install pytest pytest-cov pytest-mock
Expand Down
6 changes: 6 additions & 0 deletions src/myfm/utils/encoders/categorical.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ def _get_index(self, x: T) -> Optional[int]:
return None
raise

def __getitem__(self, x: T) -> int:
result = self._get_index(x)
if result is None:
raise KeyError(f"{x} not found.")
return result

def names(self) -> List[str]:
return [str(y) for y in self.values]

Expand Down

0 comments on commit 6b2c6d0

Please sign in to comment.