Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def fakeredis_connection():
return fakeredis.FakeRedis()
def setUp(self):
""" Set up the required fixtures """
""" """
# TODO see if testconfiguration can put a prefix on redis keys to prevent overlap
self.redis = fakeredis.FakeRedis()
fixtures.business.import_fixtures(self)
fixtures.npc.import_fixtures(self)
fixtures.region.import_fixtures(self)
fixtures.motivation.import_fixtures(self)
fixtures.phobia.import_fixtures(self)
fixtures.city.import_fixtures(self)
fixtures.organization.import_fixtures(self)
fixtures.leader.import_fixtures(self)
fixtures.country.import_fixtures(self)
def setUp(self):
""" Set up the required fixtures """
self.redis = fakeredis.FakeRedis()
fixtures.continent.import_fixtures(self)
fixtures.country.import_fixtures(self)
fixtures.leader.import_fixtures(self)
fixtures.npc.import_fixtures(self)
fixtures.motivation.import_fixtures(self)
fixtures.phobia.import_fixtures(self)
fixtures.organization.import_fixtures(self)
fixtures.region.import_fixtures(self)
fixtures.city.import_fixtures(self)
fixtures.business.import_fixtures(self)
self.redis.lpush('npc_race','gnome')
def tearDown(self):
def setUp(self):
""" """
self.redis = fakeredis.FakeRedis()
fixtures.wanted.import_fixtures(self)
fixtures.npc.import_fixtures(self)
fixtures.phobia.import_fixtures(self)
fixtures.motivation.import_fixtures(self)
self.redis.lpush('npc_race','gnome')
def setUp(self):
""" """
self.redis = fakeredis.FakeRedis()
fixtures.npc.import_fixtures(self)
fixtures.phobia.import_fixtures(self)
fixtures.motivation.import_fixtures(self)
fixtures.legend.import_fixtures(self)
self.redis.lpush('npc_race','gnome')
def setUp(self):
self.redis = fakeredis.FakeRedis()
fixtures.star.import_fixtures(self)
@mock.patch('textpipe.wrappers.Redis', FakeRedis)
def test_gensim_word2vec_with_redis():
# Load word2vec model into fake Redis
kv = RedisKeyedVectors('redis://host:1234/0', 'nl')
kv.load_keyed_vectors_into_redis('tests/models/gensim_test_nl.kv')
expected_doc_2 = [0.0076740906, -0.051765148, -0.008963874, -0.16817021, -0.12640671,
-0.28199115, -0.1418166, -0.08547635, -0.1489038, 0.049820565]
actual_doc_2 = Doc(TEXT_2, gensim_vectors={'nl': kv}).generate_gensim_document_embedding(
model_uri='redis://host:1234/0')
if not np.allclose(actual_doc_2, expected_doc_2):
raise AssertionError(actual_doc_2)
expected_doc_5 = [0.04336167, -0.12551728, 0.121972464, -0.023885678, -0.0892916, 0.011041589,
-0.022286428, 0.06333805, 0.07664292, 0.086685486]
actual_doc_5 = Doc(TEXT_5).generate_gensim_document_embedding(model_uri='redis://host:1234/0')
if not np.allclose(actual_doc_5, expected_doc_5):
def setUp(self):
""" """
self.redis = fakeredis.FakeRedis()
fixtures.npc.import_fixtures(self)
fixtures.phobia.import_fixtures(self)
fixtures.motivation.import_fixtures(self)
fixtures.grafitti.import_fixtures(self)
self.redis.lpush('npc_race','gnome')
def main():
log.startLogging(sys.stdout)
import job
import fakeredis
reactor.listenTCP(8000, JobTrackerFactory(fakeredis.FakeRedis(), job.Job))
reactor.run()