Skip to content

Commit

Permalink
fix broken english in tests (#2773)
Browse files Browse the repository at this point in the history
  • Loading branch information
piskvorky authored Mar 23, 2020
1 parent a811a23 commit d952a51
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
2 changes: 1 addition & 1 deletion gensim/test/test_fasttext.py
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ def test_contains(self):
self.assertFalse('nights' in self.test_model.wv.vocab)
self.assertTrue('nights' in self.test_model.wv)

@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues")
@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed")
def test_wm_distance(self):
doc = ['night', 'payment']
oov_doc = ['nights', 'forests', 'payments']
Expand Down
2 changes: 1 addition & 1 deletion gensim/test/test_fasttext_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def testContains(self):
self.assertFalse('a!@' in self.test_model.wv.vocab)
self.assertFalse('a!@' in self.test_model)

@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues")
@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed")
def testWmdistance(self):
"""Tests wmdistance for docs with in-vocab and out-of-vocab words"""
doc = ['night', 'payment']
Expand Down
24 changes: 12 additions & 12 deletions gensim/test/test_similarities.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def testFull(self, num_best=None, shardsize=100):

def testNumBest(self):
if self.cls == similarities.WmdSimilarity and not PYEMD_EXT:
self.skipTest("pyemd not installed or have some issues")
self.skipTest("pyemd not installed")

for num_best in [None, 0, 1, 9, 1000]:
self.testFull(num_best=num_best)
Expand Down Expand Up @@ -117,7 +117,7 @@ def test_scipy2scipy_clipped(self):
def testEmptyQuery(self):
index = self.factoryMethod()
if isinstance(index, similarities.WmdSimilarity) and not PYEMD_EXT:
self.skipTest("pyemd not installed or have some issues")
self.skipTest("pyemd not installed")

query = []
try:
Expand Down Expand Up @@ -175,7 +175,7 @@ def testIter(self):

def testPersistency(self):
if self.cls == similarities.WmdSimilarity and not PYEMD_EXT:
self.skipTest("pyemd not installed or have some issues")
self.skipTest("pyemd not installed")

fname = get_tmpfile('gensim_similarities.tst.pkl')
index = self.factoryMethod()
Expand All @@ -195,7 +195,7 @@ def testPersistency(self):

def testPersistencyCompressed(self):
if self.cls == similarities.WmdSimilarity and not PYEMD_EXT:
self.skipTest("pyemd not installed or have some issues")
self.skipTest("pyemd not installed")

fname = get_tmpfile('gensim_similarities.tst.pkl.gz')
index = self.factoryMethod()
Expand All @@ -215,7 +215,7 @@ def testPersistencyCompressed(self):

def testLarge(self):
if self.cls == similarities.WmdSimilarity and not PYEMD_EXT:
self.skipTest("pyemd not installed or have some issues")
self.skipTest("pyemd not installed")

fname = get_tmpfile('gensim_similarities.tst.pkl')
index = self.factoryMethod()
Expand All @@ -237,7 +237,7 @@ def testLarge(self):

def testLargeCompressed(self):
if self.cls == similarities.WmdSimilarity and not PYEMD_EXT:
self.skipTest("pyemd not installed or have some issues")
self.skipTest("pyemd not installed")

fname = get_tmpfile('gensim_similarities.tst.pkl.gz')
index = self.factoryMethod()
Expand All @@ -259,7 +259,7 @@ def testLargeCompressed(self):

def testMmap(self):
if self.cls == similarities.WmdSimilarity and not PYEMD_EXT:
self.skipTest("pyemd not installed or have some issues")
self.skipTest("pyemd not installed")

fname = get_tmpfile('gensim_similarities.tst.pkl')
index = self.factoryMethod()
Expand All @@ -282,7 +282,7 @@ def testMmap(self):

def testMmapCompressed(self):
if self.cls == similarities.WmdSimilarity and not PYEMD_EXT:
self.skipTest("pyemd not installed or have some issues")
self.skipTest("pyemd not installed")

fname = get_tmpfile('gensim_similarities.tst.pkl.gz')
index = self.factoryMethod()
Expand All @@ -307,7 +307,7 @@ def factoryMethod(self):
# Override factoryMethod.
return self.cls(texts, self.w2v_model)

@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues")
@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed")
def testFull(self, num_best=None):
# Override testFull.

Expand All @@ -326,7 +326,7 @@ def testFull(self, num_best=None):
self.assertTrue(numpy.alltrue(sims[1:] > 0.0))
self.assertTrue(numpy.alltrue(sims[1:] < 1.0))

@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues")
@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed")
def testNonIncreasing(self):
''' Check that similarities are non-increasing when `num_best` is not
`None`.'''
Expand All @@ -342,7 +342,7 @@ def testNonIncreasing(self):
cond = sum(numpy.diff(sims2) < 0) == len(sims2) - 1
self.assertTrue(cond)

@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues")
@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed")
def testChunking(self):
# Override testChunking.

Expand All @@ -361,7 +361,7 @@ def testChunking(self):
self.assertTrue(numpy.alltrue(sim > 0.0))
self.assertTrue(numpy.alltrue(sim <= 1.0))

@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues")
@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed")
def testIter(self):
# Override testIter.

Expand Down
6 changes: 3 additions & 3 deletions gensim/test/test_word2vec.py
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ def test_compute_training_loss(self):

class TestWMD(unittest.TestCase):

@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues")
@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed")
def testNonzero(self):
'''Test basic functionality with a test sentence.'''

Expand All @@ -1033,7 +1033,7 @@ def testNonzero(self):
# Check that distance is non-zero.
self.assertFalse(distance == 0.0)

@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues")
@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed")
def testSymmetry(self):
'''Check that distance is symmetric.'''

Expand All @@ -1044,7 +1044,7 @@ def testSymmetry(self):
distance2 = model.wv.wmdistance(sentence2, sentence1)
self.assertTrue(np.allclose(distance1, distance2))

@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed or have some issues")
@unittest.skipIf(PYEMD_EXT is False, "pyemd not installed")
def testIdenticalSentences(self):
'''Check that the distance from a sentence to itself is zero.'''

Expand Down

0 comments on commit d952a51

Please sign in to comment.