##// END OF EJS Templates
Added test for the pretty.py extension and fixed sphinx docs....
Brian Granger -
Show More
@@ -0,0 +1,56 b''
1 #!/usr/bin/env python
2 # encoding: utf-8
3 """
4 Simple tests for :mod:`IPython.extensions.pretty`.
5 """
6
7 #-----------------------------------------------------------------------------
8 # Copyright (C) 2008-2009 The IPython Development Team
9 #
10 # Distributed under the terms of the BSD License. The full license is in
11 # the file COPYING, distributed as part of this software.
12 #-----------------------------------------------------------------------------
13
14 #-----------------------------------------------------------------------------
15 # Imports
16 #-----------------------------------------------------------------------------
17
18 import sys
19 from unittest import TestCase
20
21 from IPython.core.component import Component, masquerade_as
22 from IPython.core.iplib import InteractiveShell
23 from IPython.extensions import pretty as pretty_ext
24 from IPython.external import pretty
25
26 from IPython.utils.traitlets import Bool
27
28 #-----------------------------------------------------------------------------
29 # Tests
30 #-----------------------------------------------------------------------------
31
32
33 class InteractiveShellStub(Component):
34 pprint = Bool(True)
35
36 class A(object):
37 pass
38
39 def a_pprinter(o, p, c):
40 return p.text("<A>")
41
42 class TestPrettyResultDisplay(TestCase):
43
44 def setUp(self):
45 self.ip = InteractiveShellStub(None)
46 # This allows our stub to be retrieved instead of the real InteractiveShell
47 masquerade_as(self.ip, InteractiveShell)
48 self.prd = pretty_ext.PrettyResultDisplay(self.ip, name='pretty_result_display')
49
50 def test_for_type(self):
51 self.prd.for_type(A, a_pprinter)
52 a = A()
53 result = pretty.pretty(a)
54 self.assertEquals(result, "<A>")
55
56
@@ -1,192 +1,192 b''
1 1 # -*- coding: utf-8 -*-
2 2 #
3 3 # IPython documentation build configuration file.
4 4
5 5 # NOTE: This file has been edited manually from the auto-generated one from
6 6 # sphinx. Do NOT delete and re-generate. If any changes from sphinx are
7 7 # needed, generate a scratch one and merge by hand any new fields needed.
8 8
9 9 #
10 10 # This file is execfile()d with the current directory set to its containing dir.
11 11 #
12 12 # The contents of this file are pickled, so don't put values in the namespace
13 13 # that aren't pickleable (module imports are okay, they're removed automatically).
14 14 #
15 15 # All configuration values have a default value; values that are commented out
16 16 # serve to show the default value.
17 17
18 18 import sys, os
19 19
20 20 # If your extensions are in another directory, add it here. If the directory
21 21 # is relative to the documentation root, use os.path.abspath to make it
22 22 # absolute, like shown here.
23 23 sys.path.append(os.path.abspath('../sphinxext'))
24 24
25 25 # Import support for ipython console session syntax highlighting (lives
26 26 # in the sphinxext directory defined above)
27 27 import ipython_console_highlighting
28 28
29 29 # We load the ipython release info into a dict by explicit execution
30 30 iprelease = {}
31 31 execfile('../../IPython/core/release.py',iprelease)
32 32
33 33 # General configuration
34 34 # ---------------------
35 35
36 36 # Add any Sphinx extension module names here, as strings. They can be extensions
37 37 # coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
38 38 extensions = [
39 39 # 'matplotlib.sphinxext.mathmpl',
40 40 'matplotlib.sphinxext.only_directives',
41 41 # 'matplotlib.sphinxext.plot_directive',
42 42 'sphinx.ext.autodoc',
43 43 'sphinx.ext.doctest',
44 44 'inheritance_diagram',
45 45 'ipython_console_highlighting',
46 46 'numpydoc', # to preprocess docstrings
47 47 ]
48 48
49 49 # Add any paths that contain templates here, relative to this directory.
50 50 templates_path = ['_templates']
51 51
52 52 # The suffix of source filenames.
53 53 source_suffix = '.txt'
54 54
55 55 # The master toctree document.
56 56 master_doc = 'index'
57 57
58 58 # General substitutions.
59 59 project = 'IPython'
60 60 copyright = '2008, The IPython Development Team'
61 61
62 62 # The default replacements for |version| and |release|, also used in various
63 63 # other places throughout the built documents.
64 64 #
65 65 # The full version, including alpha/beta/rc tags.
66 66 release = iprelease['version']
67 67 # The short X.Y version.
68 68 version = '.'.join(release.split('.',2)[:2])
69 69
70 70
71 71 # There are two options for replacing |today|: either, you set today to some
72 72 # non-false value, then it is used:
73 73 #today = ''
74 74 # Else, today_fmt is used as the format for a strftime call.
75 75 today_fmt = '%B %d, %Y'
76 76
77 77 # List of documents that shouldn't be included in the build.
78 78 #unused_docs = []
79 79
80 80 # List of directories, relative to source directories, that shouldn't be searched
81 81 # for source files.
82 82 exclude_dirs = ['attic']
83 83
84 84 # If true, '()' will be appended to :func: etc. cross-reference text.
85 85 #add_function_parentheses = True
86 86
87 87 # If true, the current module name will be prepended to all description
88 88 # unit titles (such as .. function::).
89 89 #add_module_names = True
90 90
91 91 # If true, sectionauthor and moduleauthor directives will be shown in the
92 92 # output. They are ignored by default.
93 93 #show_authors = False
94 94
95 95 # The name of the Pygments (syntax highlighting) style to use.
96 96 pygments_style = 'sphinx'
97 97
98 98
99 99 # Options for HTML output
100 100 # -----------------------
101 101
102 102 # The style sheet to use for HTML and HTML Help pages. A file of that name
103 103 # must exist either in Sphinx' static/ path, or in one of the custom paths
104 104 # given in html_static_path.
105 105 html_style = 'default.css'
106 106
107 107 # The name for this set of Sphinx documents. If None, it defaults to
108 108 # "<project> v<release> documentation".
109 109 #html_title = None
110 110
111 111 # The name of an image file (within the static path) to place at the top of
112 112 # the sidebar.
113 113 #html_logo = None
114 114
115 115 # Add any paths that contain custom static files (such as style sheets) here,
116 116 # relative to this directory. They are copied after the builtin static files,
117 117 # so a file named "default.css" will overwrite the builtin "default.css".
118 118 html_static_path = ['_static']
119 119
120 120 # If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
121 121 # using the given strftime format.
122 122 html_last_updated_fmt = '%b %d, %Y'
123 123
124 124 # If true, SmartyPants will be used to convert quotes and dashes to
125 125 # typographically correct entities.
126 126 #html_use_smartypants = True
127 127
128 128 # Custom sidebar templates, maps document names to template names.
129 129 #html_sidebars = {}
130 130
131 131 # Additional templates that should be rendered to pages, maps page names to
132 132 # template names.
133 133 #html_additional_pages = {}
134 134
135 135 # If false, no module index is generated.
136 136 #html_use_modindex = True
137 137
138 138 # If true, the reST sources are included in the HTML build as _sources/<name>.
139 139 #html_copy_source = True
140 140
141 141 # If true, an OpenSearch description file will be output, and all pages will
142 142 # contain a <link> tag referring to it. The value of this option must be the
143 143 # base URL from which the finished HTML is served.
144 144 #html_use_opensearch = ''
145 145
146 146 # If nonempty, this is the file name suffix for HTML files (e.g. ".xhtml").
147 147 #html_file_suffix = ''
148 148
149 149 # Output file base name for HTML help builder.
150 150 htmlhelp_basename = 'ipythondoc'
151 151
152 152
153 153 # Options for LaTeX output
154 154 # ------------------------
155 155
156 156 # The paper size ('letter' or 'a4').
157 157 latex_paper_size = 'letter'
158 158
159 159 # The font size ('10pt', '11pt' or '12pt').
160 160 latex_font_size = '11pt'
161 161
162 162 # Grouping the document tree into LaTeX files. List of tuples
163 163 # (source start file, target name, title, author, document class [howto/manual]).
164 164
165 165 latex_documents = [ ('index', 'ipython.tex', 'IPython Documentation',
166 166 ur"""The IPython Development Team""",
167 'manual'),
167 'manual', True),
168 168 ]
169 169
170 170 # The name of an image file (relative to this directory) to place at the top of
171 171 # the title page.
172 172 #latex_logo = None
173 173
174 174 # For "manual" documents, if this is true, then toplevel headings are parts,
175 175 # not chapters.
176 176 #latex_use_parts = False
177 177
178 178 # Additional stuff for the LaTeX preamble.
179 179 #latex_preamble = ''
180 180
181 181 # Documents to append as an appendix to all manuals.
182 182 #latex_appendices = []
183 183
184 184 # If false, no module index is generated.
185 185 #latex_use_modindex = True
186 186
187 187
188 188 # Cleanup
189 189 # -------
190 190 # delete release info to avoid pickling errors from sphinx
191 191
192 192 del iprelease
General Comments 0
You need to be logged in to leave comments. Login now