Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
test(indexer): fix data path in unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
hanhxiao committed Jul 18, 2019
1 parent b1a23ca commit 51eafac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/api/

# PyBuilder
target/
Expand Down
3 changes: 2 additions & 1 deletion release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ function pub_gittag {
function make_chore_pr {
git checkout -B "chore-bumping-version"
git add ./CHANGELOG.md
git add $INIT_FILE
git commit -m "chore(changelog): update change log to $1"
git push $SOURCE_ORIGIN chore-bumping-version --force
hub pull-request -m "chore(changelog): update change log to $1" --no-edit -l new-release -r gnes-ai/dev-core
Expand Down Expand Up @@ -102,7 +103,7 @@ then
pub_pypi
pub_gittag
# change the version line back
mv ${TMP_INIT_FILE} $INIT_FILE
# mv ${TMP_INIT_FILE} $INIT_FILE
make_chore_pr $VER
fi

Expand Down
6 changes: 2 additions & 4 deletions tests/test_bindexer.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def test_nsw_search(self):
rs[i] = sorted(rs[i], key=lambda x: (x[3], -x[0]))
fd.close()
self.assertEqual(rs, self.toy_exp)
os.remove(self.dump_path + '_1')

def test_force_search(self):
fd = BIndexer(self.toy_data.shape[1], data_path=self.dump_path + '_2')
Expand All @@ -51,16 +50,15 @@ def test_force_search(self):
rs[i] = sorted(rs[i], key=lambda x: (x[3], -x[0]))
fd.close()
self.assertEqual(rs, self.toy_exp)
os.remove(self.dump_path + '_2')

def test_dump_load(self):
fd = BIndexer(self.toy_data.shape[1], data_path=self.dump_path + '_3')
fd.add(self.toy_label, self.toy_data, self.weights)
fd.dump(self.dump_path + '_3')
fd.dump()
fd.close()
# shutil.rmtree(self.data_path + "_3")

fd2 = BIndexer.load(self.dump_path + '_3')
fd2 = BIndexer.load(fd.dump_full_path)
rs = fd2.query(self.toy_query, 2, normalized_score=False)
for i in range(len(rs)):
rs[i] = sorted(rs[i], key=lambda x: (x[3], -x[0]))
Expand Down

0 comments on commit 51eafac

Please sign in to comment.