This article was originally published by Python Magazine in March of 2008.

Automated Testing with unittest and Proctor

Listing9.py

#!/usr/bin/env python
# Test code with circular reference to illustrate garbage collection

import unittest

class CircularReferenceTest(unittest.TestCase):

    def test(self):
        a = []
        b = []
        b.append(a)
        a.append(b)
        return

Original Format