~ubuntu-branches/ubuntu/jaunty/python-docutils/jaunty

« back to all changes in this revision

Viewing changes to test/test_parsers/test_rst/test_directives/test_include.py

  • Committer: Bazaar Package Importer
  • Author(s): Simon McVittie
  • Date: 2008-07-24 10:39:53 UTC
  • mfrom: (1.1.4 upstream) (3.1.7 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080724103953-8gh4uezg17g9ysgy
Tags: 0.5-2
* Upload docutils 0.5 to unstable
* Update rst.el to upstream Subversion r5596, which apparently fixes
  all its performance problems (17_speed_up_rst_el.dpatch, closes: #474941)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /usr/bin/env python
2
2
 
3
 
# Author: David Goodger
4
 
# Contact: goodger@users.sourceforge.net
5
 
# Revision: $Revision: 4212 $
6
 
# Date: $Date: 2005-12-14 15:51:34 +0100 (Wed, 14 Dec 2005) $
 
3
# $Id: test_include.py 5015 2007-03-12 20:25:40Z wiemann $
 
4
# Author: David Goodger <goodger@python.org>
7
5
# Copyright: This module has been placed in the public domain.
8
6
 
9
7
"""
31
29
include10rel = DocutilsTestSupport.utils.relative_path(None, include10)
32
30
include11 = os.path.join(mydir, 'include 11.txt')
33
31
include11rel = DocutilsTestSupport.utils.relative_path(None, include11)
 
32
include12 = os.path.join(mydir, 'include12.txt')
 
33
include13 = os.path.join(mydir, 'include13.txt')
 
34
include13rel = DocutilsTestSupport.utils.relative_path(None, include13)
34
35
utf_16_file = os.path.join(mydir, 'utf-16.csv')
35
36
utf_16_file_rel = DocutilsTestSupport.utils.relative_path(None, utf_16_file)
36
37
nonexistent = os.path.join(os.path.dirname(states.__file__),
392
393
        <literal_block xml:space="preserve">
393
394
            .. include:: <nonexistent>
394
395
""" % nonexistent_rel],
 
396
["""\
 
397
Include start-after/end-before Test
 
398
 
 
399
.. include:: %s
 
400
   :start-after: .. start here
 
401
   :end-before: .. stop here
 
402
 
 
403
A paragraph.
 
404
""" % include12,
 
405
"""\
 
406
<document source="test data">
 
407
    <paragraph>
 
408
        Include start-after/end-before Test
 
409
    <paragraph>
 
410
        In include12.txt (after "start here", before "stop here")
 
411
    <paragraph>
 
412
        A paragraph.
 
413
"""],
 
414
["""\
 
415
Include start-after/end-before Test, single option variant
 
416
 
 
417
.. include:: %s
 
418
   :end-before: .. start here
 
419
 
 
420
.. include:: %s
 
421
   :start-after: .. stop here
 
422
 
 
423
A paragraph.
 
424
""" % (include12, include12),
 
425
"""\
 
426
<document source="test data">
 
427
    <paragraph>
 
428
        Include start-after/end-before Test, single option variant
 
429
    <paragraph>
 
430
        In include12.txt (but before "start here")
 
431
    <paragraph>
 
432
        In include12.txt (after "stop here")
 
433
    <paragraph>
 
434
        A paragraph.
 
435
"""],
 
436
["""\
 
437
Include start-after/end-before multi-line test.
 
438
 
 
439
.. include:: %s
 
440
   :start-after: From: me
 
441
                 To: you
 
442
   :end-before: -------
 
443
                -- mork of ork
 
444
 
 
445
.. include:: %s
 
446
   :start-after: From: me
 
447
                 To: you
 
448
   :end-before:
 
449
       -------
 
450
         -- mork of ork
 
451
 
 
452
A paragraph.
 
453
""" % (include13, include13),
 
454
"""\
 
455
<document source="test data">
 
456
    <paragraph>
 
457
        Include start-after/end-before multi-line test.
 
458
    <system_message level="4" line="3" source="test data" type="SEVERE">
 
459
        <paragraph>
 
460
            Problem with "end-before" option of "include" directive:
 
461
            Text not found.
 
462
        <literal_block xml:space="preserve">
 
463
            .. include:: %s
 
464
               :start-after: From: me
 
465
                             To: you
 
466
               :end-before: -------
 
467
                            -- mork of ork
 
468
    <paragraph>
 
469
        In include13.txt (between header and signature)
 
470
    <paragraph>
 
471
        A paragraph.
 
472
""" % include13],
 
473
["""\
 
474
Error handling test; "end-before" error handling tested in previous test.
 
475
 
 
476
.. include:: %s
 
477
   :start-after: bad string
 
478
   :end-before: mork of ork
 
479
""" % include13,
 
480
"""\
 
481
<document source="test data">
 
482
    <paragraph>
 
483
        Error handling test; "end-before" error handling tested in previous test.
 
484
    <system_message level="4" line="3" source="test data" type="SEVERE">
 
485
        <paragraph>
 
486
            Problem with "start-after" option of "include" directive:
 
487
            Text not found.
 
488
        <literal_block xml:space="preserve">
 
489
            .. include:: %s
 
490
               :start-after: bad string
 
491
               :end-before: mork of ork
 
492
""" % include13],
395
493
]
396
494
 
397
495