def METHOD_NAME(self):
    d1 = defaultdict()
    def foo(): return 42
    d2 = defaultdict(foo, {1: 2})
    # NOTE: We can't use tempfile.[Named]TemporaryFile since this
    # code must exercise the tp_print C code, which only gets
    # invoked for *real* files.
    tfn = tempfile.mktemp()
    try:
        f = open(tfn, "w+")
        try:
            print >>f, d1
            print >>f, d2
            f.seek(0)
            self.assertEqual(f.readline(), repr(d1) + "\n")
            self.assertEqual(f.readline(), repr(d2) + "\n")
        finally:
            f.close()
    finally:
        os.remove(tfn)