# Path: pympler/refbrowser.py
# class _Node(object):
# class RefBrowser(object):
# class StreamBrowser(RefBrowser):
# class ConsoleBrowser(StreamBrowser):
# class FileBrowser(StreamBrowser):
#     class _TreeNode(_TreeWidget.TreeNode):
#     class _ReferrerTreeItem(_TreeWidget.TreeItem, tkinter.Label):
# class InteractiveBrowser(RefBrowser):
#     def __init__(self, o, str_func=None):
#     def __str__(self):
#     def __init__(self, rootobject, maxdepth=3, str_func=summary._repr,
#                  repeat=True, stream=None):
#     def get_tree(self):
#     def _get_tree(self, root, maxdepth):
#     def print_tree(self, tree=None):
#     def _print(self, tree, prefix, carryon):
#     def __init__(self, *args, **kwargs):
#     def print_tree(self, filename, tree=None):
#         def reload_referrers(self):
#         def print_object(self):
#         def drawtext(self):
#             def do_popup(event):
#             def edit(self, event=None):
#             def edit_finish(self, event=None):
#             def edit_cancel(self, event=None):
#         def __init__(self, parentwindow, node, reftree):  # constr calls
#         def _clear_children(self):
#         def GetText(self):
#         def GetIconName(self):
#         def IsExpandable(self):
#         def GetSubList(self):
# def gui_default_str_function(o):
#     def __init__(self, rootobject, maxdepth=3,
#                  str_func=gui_default_str_function, repeat=True):
#     def main(self, standalone=False):
# def foo(o):
# def print_sample():
# def write_sample():


import copy
import doctest
import gc
import os
import sys
import unittest
from io import StringIO
from tempfile import mkstemp
from pympler import refbrowser
        expected = 'the quick brown fox'
        def foo(o): return expected
        res = refbrowser.RefBrowser(root, str_func=foo, maxdepth=2).get_tree()
        self.assertEqual(str(res), expected)
        res = refbrowser.RefBrowser(root, str_func=foo, repeat=True,\
                                    maxdepth=2).get_tree()
        self.assertEqual(str(res), expected)


    def test_console_browser(self):
        """Test ConsoleBrowser uses stdout by default."""
        crb = refbrowser.ConsoleBrowser(None, maxdepth=2)
        self.assertEqual(crb.stream, sys.stdout)


    def test_file_browser(self):
        crb = refbrowser.FileBrowser(None, maxdepth=1)
        fhandle, fname = mkstemp(prefix='test_file_browser', text=True)
        os.close(fhandle)
        try:
            crb.print_tree(fname, tree=self.sample_tree)
            output = open(fname).read()
            self.assertEqual(output.strip(), self.TREE_DEP_1)
        finally:
            os.unlink(fname)


    def test_print_tree(self):
        """Test reference browser prints root object by default."""
        out1 = StringIO()

# Path: pympler/refbrowser.py
# class _Node(object):
# class RefBrowser(object):
# class StreamBrowser(RefBrowser):
# class ConsoleBrowser(StreamBrowser):
# class FileBrowser(StreamBrowser):
#     class _TreeNode(_TreeWidget.TreeNode):
#     class _ReferrerTreeItem(_TreeWidget.TreeItem, tkinter.Label):
# class InteractiveBrowser(RefBrowser):
#     def __init__(self, o, str_func=None):
#     def __str__(self):
#     def __init__(self, rootobject, maxdepth=3, str_func=summary._repr,
#                  repeat=True, stream=None):
#     def get_tree(self):
#     def _get_tree(self, root, maxdepth):
#     def print_tree(self, tree=None):
#     def _print(self, tree, prefix, carryon):
#     def __init__(self, *args, **kwargs):
#     def print_tree(self, filename, tree=None):
#         def reload_referrers(self):
#         def print_object(self):
#         def drawtext(self):
#             def do_popup(event):
#             def edit(self, event=None):
#             def edit_finish(self, event=None):
#             def edit_cancel(self, event=None):
#         def __init__(self, parentwindow, node, reftree):  # constr calls
#         def _clear_children(self):
#         def GetText(self):
#         def GetIconName(self):
#         def IsExpandable(self):
#         def GetSubList(self):
# def gui_default_str_function(o):
#     def __init__(self, rootobject, maxdepth=3,
#                  str_func=gui_default_str_function, repeat=True):
#     def main(self, standalone=False):
# def foo(o):
# def print_sample():
# def write_sample():


# Path: test/muppy/test_refbrowser.py
import copy
import doctest
import gc
import os
import sys
import unittest
from io import StringIO
from tempfile import mkstemp
from pympler import refbrowser

        expected = 'the quick brown fox'
        def foo(o): return expected
        res = refbrowser.RefBrowser(root, str_func=foo, maxdepth=2).get_tree()
        self.assertEqual(str(res), expected)
        res = refbrowser.RefBrowser(root, str_func=foo, repeat=True,\
                                    maxdepth=2).get_tree()
        self.assertEqual(str(res), expected)


    def test_console_browser(self):
        """Test ConsoleBrowser uses stdout by default."""
        crb = refbrowser.ConsoleBrowser(None, maxdepth=2)
        self.assertEqual(crb.stream, sys.stdout)


    def test_file_browser(self):
        crb = refbrowser.FileBrowser(None, maxdepth=1)
        fhandle, fname = mkstemp(prefix='test_file_browser', text=True)
        os.close(fhandle)
        try:
            crb.print_tree(fname, tree=self.sample_tree)
            output = open(fname).read()
            self.assertEqual(output.strip(), self.TREE_DEP_1)
        finally:
            os.unlink(fname)


    def test_print_tree(self):
        """Test reference browser prints root object by default."""
        out1 = StringIO()

        crb = refbrowser.StreamBrowser(copy.copy(self.sample_tree), maxdepth=1, stream=out1)