[sagenb] 114/179: fix doctests in sagenb/notebook/worksheet.py

felix salfelder felix-guest at moszumanska.debian.org
Tue May 6 12:05:15 UTC 2014


This is an automated email from the git hooks/post-receive script.

felix-guest pushed a commit to branch master
in repository sagenb.

commit acf2515727be9f532d24d5f231433409b4b250a8
Author: P Purkayastha <ppurka at gmail.com>
Date:   Fri May 3 14:10:38 2013 +0800

    fix doctests in sagenb/notebook/worksheet.py
---
 sagenb/notebook/worksheet.py | 60 +++++++++++++++++++++++++++++++++++++++++++-
 1 file changed, 59 insertions(+), 1 deletion(-)

diff --git a/sagenb/notebook/worksheet.py b/sagenb/notebook/worksheet.py
index 4bea87e..5491237 100644
--- a/sagenb/notebook/worksheet.py
+++ b/sagenb/notebook/worksheet.py
@@ -193,6 +193,7 @@ class Worksheet(object):
         EXAMPLES: We test the constructor via an indirect doctest::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: import sagenb.notebook.misc
             sage: sagenb.notebook.misc.notebook = nb
             sage: W = nb.create_new_worksheet('Test with unicode ěščřžýáíéďĎ', 'admin')
@@ -437,6 +438,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W2 = nb.create_new_worksheet('test2', 'admin')
             sage: W1 = nb.create_new_worksheet('test1', 'admin')
             sage: cmp(W1, W2)
@@ -459,6 +461,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('test1', 'admin')
             sage: W.__repr__()
             'admin/0: [Cell 1: in=, out=]'
@@ -476,6 +479,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('test1', 'admin')
             sage: len(W)
             1
@@ -508,7 +512,7 @@ class Worksheet(object):
         is of course False::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
-            sage: nb.user_manager().add_user('_sage_', 'password', '', force=True)
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('test1', 'admin')
             sage: W.docbrowser()
             False
@@ -534,6 +538,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('test1', 'admin')
             sage: C = W.collaborators(); C
             []
@@ -559,6 +564,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('test1', 'admin')
             sage: C = W.collaborators(); C
             []
@@ -586,6 +592,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.load_notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: nb.user_manager().add_user('sage','sage','sage at sagemath.org',force=True)
             sage: nb.user_manager().add_user('hilbert','sage','sage at sagemath.org',force=True)
             sage: W = nb.create_new_worksheet('test1', 'admin')
@@ -613,6 +620,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: nb.user_manager().add_user('sage','sage','sage at sagemath.org',force=True)
             sage: nb.user_manager().add_user('hilbert','sage','sage at sagemath.org',force=True)
             sage: W = nb.create_new_worksheet('test1', 'admin')
@@ -641,6 +649,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('test1', 'admin')
             sage: C = W.viewers(); C
             []
@@ -665,6 +674,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: nb.user_manager().add_user('hilbert','sage','sage at sagemath.org',force=True)
             sage: W = nb.create_new_worksheet('test1', 'admin')
             sage: W.add_viewer('hilbert')
@@ -691,6 +701,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.name()
             u'A Test Worksheet'
@@ -715,6 +726,7 @@ class Worksheet(object):
         EXAMPLES: We create a worksheet and change the name::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.set_name('A renamed worksheet')
             sage: W.name()
@@ -737,6 +749,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.load_notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.filename()
             'admin/0'
@@ -758,6 +771,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.load_notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.filename()
             'admin/0'
@@ -778,6 +792,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.filename()
             'admin/0'
@@ -794,6 +809,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.filename_without_owner()
             '0'
@@ -812,6 +828,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.directory()
             '.../home/admin/0'
@@ -827,6 +844,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.data_directory()
             '.../home/admin/0/data'
@@ -846,6 +864,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.attached_data_files()
             []
@@ -868,6 +887,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.cells_directory()
             '.../home/admin/0/cells'
@@ -893,6 +913,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.notebook()
             <...sagenb.notebook.notebook.Notebook...>
@@ -917,6 +938,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.system()
             'sage'
@@ -962,6 +984,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.set_system('magma')
             sage: W.system()
@@ -980,6 +1003,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.pretty_print()
             False
@@ -1015,6 +1039,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('A Test Worksheet', 'admin')
             sage: W.set_pretty_print('false')
             sage: W.pretty_print()
@@ -1059,6 +1084,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: W.is_published()
             False
@@ -1079,6 +1105,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.load_notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: W.worksheet_that_was_published() is W
             True
@@ -1104,6 +1131,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: S = nb.publish_worksheet(W, 'admin')
             sage: S.publisher()
@@ -1123,6 +1151,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.load_notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: P = nb.publish_worksheet(W, 'admin')
             sage: P.is_publisher('hearst')
@@ -1141,6 +1170,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: P = nb.publish_worksheet(W, 'admin')
             sage: P.has_published_version()
@@ -1166,6 +1196,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: P = nb.publish_worksheet(W, 'admin')  # indirect test
             sage: W._Worksheet__published_version
@@ -1186,6 +1217,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.load_notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: P = nb.publish_worksheet(W, 'admin')
             sage: W.published_version() is P
@@ -1214,6 +1246,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.load_notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: P = nb.publish_worksheet(W, 'admin')
             sage: P.worksheet_that_was_published() is W
@@ -1249,6 +1282,7 @@ class Worksheet(object):
         ::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: W.rate(3, 'this is great', 'hilbert')
             sage: W.ratings()
@@ -1284,6 +1318,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: W.rate(0, 'this lacks content', 'riemann')
             sage: W.is_rater('admin')
@@ -1307,6 +1342,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: W.ratings()
             []
@@ -1334,6 +1370,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: W.rate(0, 'this lacks content', 'riemann')
             sage: W.rate(3, 'this is great', 'hilbert')
@@ -1352,6 +1389,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: W.rating()
             -1
@@ -1380,6 +1418,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: W.everyone_has_deleted_this_worksheet()
             False
@@ -1414,6 +1453,7 @@ class Worksheet(object):
         ACTIVE::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: W.user_view('admin')
             1
@@ -1495,6 +1535,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: W.set_user_view('admin', sagenb.notebook.worksheet.ARCHIVED)
             sage: W.user_view('admin') == sagenb.notebook.worksheet.ARCHIVED
@@ -1527,6 +1568,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Publish Test', 'admin')
             sage: W.user_view_is('admin', sagenb.notebook.worksheet.ARCHIVED)
             False
@@ -1548,6 +1590,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Archived Test', 'admin')
             sage: W.is_archived('admin')
             False
@@ -1570,6 +1613,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Active Test', 'admin')
             sage: W.is_active('admin')
             True
@@ -1592,6 +1636,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Trash Test', 'admin')
             sage: W.is_trashed('admin')
             False
@@ -1612,6 +1657,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Archive Test', 'admin')
             sage: W.move_to_archive('admin')
             sage: W.is_archived('admin')
@@ -1632,6 +1678,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Active Test', 'admin')
             sage: W.move_to_archive('admin')
             sage: W.is_active('admin')
@@ -1653,6 +1700,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Trash Test', 'admin')
             sage: W.move_to_trash('admin')
             sage: W.is_trashed('admin')
@@ -1673,6 +1721,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Active Test', 'admin')
             sage: W.move_to_trash('admin')
             sage: W.is_active('admin')
@@ -1690,6 +1739,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: nb.user_manager().add_user('sage','sage','sage at sagemath.org',force=True)
             sage: W = nb.create_new_worksheet('Test', 'sage')
             sage: W.edit_save('{{{\n3^20\n}}}')
@@ -1861,6 +1911,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: nb.user_manager().add_user('diophantus','sage','sage at sagemath.org',force=True)
             sage: W = nb.create_new_worksheet('Viewer test', 'admin')
             sage: W.add_viewer('diophantus')
@@ -1884,6 +1935,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: nb.user_manager().add_user('diophantus','sage','sage at sagemath.org',force=True)
             sage: W = nb.create_new_worksheet('Collaborator test', 'admin')
             sage: W.collaborators()
@@ -2354,6 +2406,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Test', 'admin')
             sage: W.html()
             u'...cell_input_active...worksheet_cell_list...cell_1...cell_output_html_1...'
@@ -2534,6 +2587,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Test Edit Save', 'admin')
 
         Now we set the worksheet to have two cells with the default id of 0
@@ -2588,6 +2642,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Test Edit Save', 'admin')
             sage: W.edit_save('{{{\n2+3\n///\n5\n}}}\n{{{\n2+8\n///\n10\n}}}')
             sage: v = W.cell_list(); v
@@ -2620,6 +2675,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Test', 'admin')
             sage: W.edit_save('foo\n{{{\n2+3\n///\n5\n}}}bar\n{{{\n2+8\n///\n10\n}}}')
             sage: v = W.compute_cell_list(); v
@@ -2644,6 +2700,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Test Edit Save', 'admin')
             sage: W
             admin/0: [Cell 1: in=, out=]
@@ -2777,6 +2834,7 @@ class Worksheet(object):
         EXAMPLES::
 
             sage: nb = sagenb.notebook.notebook.Notebook(tmp_dir()+'.sagenb')
+            sage: nb.create_default_users('password')
             sage: W = nb.create_new_worksheet('Test Delete Cell', 'admin')
             sage: W.edit_save('{{{id=foo|\n2+3\n///\n5\n}}}\n{{{id=9|\n2+8\n///\n10\n}}}{{{id=dont_delete_me|\n2*3\n///\n6\n}}}\n')
             sage: W.cell_id_list()

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/sagenb.git



More information about the debian-science-commits mailing list