Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_indexer(self):
dictConfig(config.logging_config)
logger = logging.getLogger()
table = Table("perf_table","perf_ns","instance_1")
store = Store(table,config,logger)
indexer = Indexer(table,config,logger)
max_range=1000000
insert_perf=[]
overall_start_time = timeit.default_timer()
total_seconds=0.0
for i in range(max_range):
key= ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(10))
value= ''.join(random.choice(string.ascii_uppercase + string.digits) for _ in range(100))
expected_data = (key,value)
start_time = timeit.default_timer()
position=store.save(expected_data)
indexer.put(expected_data[0],position,store)
elapsed = timeit.default_timer() - start_time
insert_perf.append(elapsed*1000.0) #to ms