Test Case in Python

Create a test case in python in the program I am using list so after each test all variables and list has to become empty.
Could any one please help.

import random as r
print(10)
for i in range(10):
n=r.randint(1,10)
l=[]
for i in range(n):
x=r.randint(1,10)
l.append(x)
print(n)
print(*l)’’’