From 256ead80b31f63ea6636f1a12b7fd2d69f237b1e Mon Sep 17 00:00:00 2001 From: droudy Date: Wed, 10 Aug 2016 08:53:57 -0400 Subject: [PATCH 1/3] fix randomstate test --- gensim/test/test_ldamodel.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gensim/test/test_ldamodel.py b/gensim/test/test_ldamodel.py index 452161a574..1cf5027ae8 100644 --- a/gensim/test/test_ldamodel.py +++ b/gensim/test/test_ldamodel.py @@ -48,12 +48,6 @@ def testfile(): return os.path.join(tempfile.gettempdir(), 'gensim_models.tst') -def testRandomState(): - testcases = [numpy.random.seed(0), None, numpy.random.RandomState(0), 0] - for testcase in testcases: - assert(isinstance(ldamodel.get_random_state(testcase), numpy.random.RandomState)) - assertEqual(ldamodel.get_random_state(testcase), numpy.random.RandomState(0)) - class TestLdaModel(unittest.TestCase): def setUp(self): self.corpus = mmcorpus.MmCorpus(datapath('testcorpus.mm')) @@ -430,6 +424,12 @@ def testLargeMmapCompressed(self): # test loading the large model arrays with mmap self.assertRaises(IOError, self.class_.load, fname, mmap='r') + def testRandomState(self): + testcases = [numpy.random.seed(0), None, numpy.random.RandomState(0), 0] + for testcase in testcases: + assert (isinstance(ldamodel.get_random_state(testcase), numpy.random.RandomState)) + self.assertEqual(ldamodel.get_random_state(testcase), numpy.random.RandomState(0)) + #endclass TestLdaModel From 2858d6e985969c606420dce56e07248a325ecb87 Mon Sep 17 00:00:00 2001 From: droudy Date: Wed, 10 Aug 2016 09:28:56 -0400 Subject: [PATCH 2/3] Revert "fix randomstate test" This reverts commit 256ead80b31f63ea6636f1a12b7fd2d69f237b1e. --- gensim/test/test_ldamodel.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/gensim/test/test_ldamodel.py b/gensim/test/test_ldamodel.py index 1cf5027ae8..452161a574 100644 --- a/gensim/test/test_ldamodel.py +++ b/gensim/test/test_ldamodel.py @@ -48,6 +48,12 @@ def testfile(): return os.path.join(tempfile.gettempdir(), 'gensim_models.tst') +def testRandomState(): + testcases = [numpy.random.seed(0), None, numpy.random.RandomState(0), 0] + for testcase in testcases: + assert(isinstance(ldamodel.get_random_state(testcase), numpy.random.RandomState)) + assertEqual(ldamodel.get_random_state(testcase), numpy.random.RandomState(0)) + class TestLdaModel(unittest.TestCase): def setUp(self): self.corpus = mmcorpus.MmCorpus(datapath('testcorpus.mm')) @@ -424,12 +430,6 @@ def testLargeMmapCompressed(self): # test loading the large model arrays with mmap self.assertRaises(IOError, self.class_.load, fname, mmap='r') - def testRandomState(self): - testcases = [numpy.random.seed(0), None, numpy.random.RandomState(0), 0] - for testcase in testcases: - assert (isinstance(ldamodel.get_random_state(testcase), numpy.random.RandomState)) - self.assertEqual(ldamodel.get_random_state(testcase), numpy.random.RandomState(0)) - #endclass TestLdaModel From c87ad2ca607f4cec62ba4fc3c799790aecabce48 Mon Sep 17 00:00:00 2001 From: Daniel Roudnitsky Date: Wed, 10 Aug 2016 09:31:44 -0400 Subject: [PATCH 3/3] fix broken testRandomState --- gensim/test/test_ldamodel.py | 1 - 1 file changed, 1 deletion(-) diff --git a/gensim/test/test_ldamodel.py b/gensim/test/test_ldamodel.py index 452161a574..c081da328a 100644 --- a/gensim/test/test_ldamodel.py +++ b/gensim/test/test_ldamodel.py @@ -52,7 +52,6 @@ def testRandomState(): testcases = [numpy.random.seed(0), None, numpy.random.RandomState(0), 0] for testcase in testcases: assert(isinstance(ldamodel.get_random_state(testcase), numpy.random.RandomState)) - assertEqual(ldamodel.get_random_state(testcase), numpy.random.RandomState(0)) class TestLdaModel(unittest.TestCase): def setUp(self):