Skip to content
Permalink
Browse files

test(indexer): fix data path in unit test

  • Loading branch information...
hanxiao committed Jul 18, 2019
1 parent b1a23ca commit 51eafac76d25c9442d1a63a2d2a431cbb00e2b44
Showing with 5 additions and 5 deletions.
  1. +1 −0 .gitignore
  2. +2 −1 release.sh
  3. +2 −4 tests/test_bindexer.py
@@ -68,6 +68,7 @@ instance/

# Sphinx documentation
docs/_build/
docs/api/

# PyBuilder
target/
@@ -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
@@ -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

@@ -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')
@@ -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]))

0 comments on commit 51eafac

Please sign in to comment.
You can’t perform that action at this time.