I believe that this is a new issue since I've been able to run this code with no issues before:
import unittest
def foo(n, seen=set()):
if n in seen:
return False
seen.add(n)
return True
class Test(unittest.TestCase):
def test_a(self):
self.assertFalse(foo(1))
def test_b(self):
self.assertFalse(foo(1))
But I'm now seeing that test_b fails since it holds onto the value of the set in the previous unittest. I was wondering how this might have started happening.