Удалить SmirnovaVYu/docs/data/data_generator.py
This commit is contained in:
parent
fce766d8be
commit
7459cb5db3
|
|
@ -1,20 +0,0 @@
|
||||||
import random
|
|
||||||
|
|
||||||
|
|
||||||
def generate_test_data(N): #Генерирует N записей с именами User_00000 ... User_N-1
|
|
||||||
records = [(f"User_{i:05d}", f"+7-999-{i:05d}") for i in range(N)]
|
|
||||||
|
|
||||||
records_shuffled = records.copy()
|
|
||||||
random.shuffle(records_shuffled)
|
|
||||||
|
|
||||||
records_sorted = sorted(records, key=lambda x: x[0])
|
|
||||||
|
|
||||||
return records, records_shuffled, records_sorted
|
|
||||||
|
|
||||||
|
|
||||||
def get_names_for_operations(records, num_find=100, num_delete=50, num_nonexistent=10): #Подготавливает имена для операций поиска и удаления
|
|
||||||
existing_names = [name for name, _ in records[:num_find + num_delete]]
|
|
||||||
names_to_find = existing_names[:num_find] + [f"None_{i}" for i in range(num_nonexistent)]
|
|
||||||
names_to_delete = existing_names[num_find:num_find + num_delete]
|
|
||||||
|
|
||||||
return names_to_find, names_to_delete
|
|
||||||
Loading…
Reference in New Issue
Block a user