Browse Source

[FIX] pass pytest

pull/5/head
troyyyyy 2 years ago
parent
commit
ea863c09e4
2 changed files with 5 additions and 3 deletions
  1. +1
    -1
      abl/reasoning/reasoner.py
  2. +4
    -2
      tests/test_reasoning.py

+ 1
- 1
abl/reasoning/reasoner.py View File

@@ -76,7 +76,7 @@ class Reasoner:
if isinstance(dist_func, str):
if dist_func not in ["hamming", "confidence", "avg_confidence"]:
raise NotImplementedError(
'Valid options for predefined dist_func include "hamming" '
'Valid options for predefined dist_func include "hamming", '
+ f'"confidence" and "avg_confidence", but got {dist_func}.'
)
return


+ 4
- 2
tests/test_reasoning.py View File

@@ -114,8 +114,10 @@ class TestReaonser(object):
def test_invalid_predefined_dist_func(self, kb_add):
with pytest.raises(NotImplementedError) as excinfo:
Reasoner(kb_add, "invalid_dist_func")
assert 'Valid options for predefined dist_func include "hamming" and "confidence"' in str(
excinfo.value
assert (
'Valid options for predefined dist_func include "hamming", "confidence" '
+ 'and "avg_confidence"'
in str(excinfo.value)
)

def random_dist(self, data_example, candidates, candidate_idxs, reasoning_results):


Loading…
Cancel
Save