I have made a python project by following a tutorial on youtube. Now, I want to write unit test to test one of it's function get_slot_machine_spin()
def get_slot_machine_spin(rows, cols, symbols):
all_symbols = []
for symbol, symbol_count in symbols.items():
for _ in range(symbol_count):
all_symbols.append(symbol)
columns = []
for _ in range(cols):
column = []
current_symbols = all_symbols[:]
for _ in range(rows):
value = random.choice(current_symbols)
current_symbols.remove(value)
column.append(value)
columns.append(column)
return columns
But, the function use random.choice in it. It returns a list with randomly generated characters. And I'm not sure how can I write a test for that.