5
:Contact: goodger@users.sourceforge.net
6
:Revision: $Revision: 1.6 $
7
:Date: $Date: 2002/07/04 01:35:55 $
8
:Copyright: This module has been placed in the public domain.
13
from __init__ import DocutilsTestSupport
16
s = DocutilsTestSupport.ParserTestSuite()
17
s.generateTests(totest)
22
totest['emphasis'] = [
44
*emphasis without closing asterisk
49
<problematic id="id2" refid="id1">
51
emphasis without closing asterisk
52
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
54
Inline emphasis start-string without end-string at line 1.
57
'*emphasis*' and 1/*emphasis*/2 and 3-*emphasis*-4 and 5:*emphasis*:6
58
but not '*' or '"*"' or x*2* or 2*x* or \\*args or *
59
or *the\\* *stars\\\\\\* *inside*
61
(however, '*args' will trigger a warning and may be problematic)
81
but not '*' or '"*"' or x*2* or 2*x* or *args or *
87
<problematic id="id2" refid="id1">
89
args' will trigger a warning and may be problematic)
90
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
92
Inline emphasis start-string without end-string at line 5.
100
Emphasized asterisk: *\\**
102
Emphasized double asterisk: *\\***
107
Emphasized asterisk: \n\
111
Emphasized double asterisk: \n\
128
(**strong**) but not (**) or '(** ' or x**2 or \\**kwargs or **
130
(however, '**kwargs' will trigger a warning and may be problematic)
138
) but not (**) or '(** ' or x**2 or **kwargs or **
141
<problematic id="id2" refid="id1">
143
kwargs' will trigger a warning and may be problematic)
144
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
146
Inline strong start-string without end-string at line 3.
149
Strong asterisk: *****
151
Strong double asterisk: ******
160
Strong double asterisk: \n\
165
**strong without closing asterisks
170
<problematic id="id2" refid="id1">
172
strong without closing asterisks
173
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
175
Inline strong start-string without end-string at line 1.
179
totest['literal'] = [
217
``literal ``TeX quotes'' & \\backslash`` but not "``" or ``
219
(however, ``standalone TeX quotes'' will trigger a warning
220
and may be problematic)
226
literal ``TeX quotes'' & \\backslash
230
<problematic id="id2" refid="id1">
232
standalone TeX quotes'' will trigger a warning
233
and may be problematic)
234
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
236
Inline literal start-string without end-string at line 3.
239
Find the ```interpreted text``` in this paragraph!
250
``literal without closing backquotes
255
<problematic id="id2" refid="id1">
257
literal without closing backquotes
258
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
260
Inline literal start-string without end-string at line 1.
264
totest['interpreted'] = [
280
<interpreted position="prefix" role="role">
289
<interpreted position="suffix" role="role">
293
:role:`interpreted`:role:
298
<problematic id="id2" refid="id1">
299
:role:`interpreted`:role:
300
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
302
Multiple roles in interpreted text at line 1 (both prefix and suffix present; only one allowed).
305
:role:`:not-role: interpreted`
310
<interpreted position="prefix" role="role">
311
:not-role: interpreted
314
:very.long-role_name:`interpreted`
319
<interpreted position="prefix" role="very.long-role_name">
323
`interpreted` but not \\`interpreted` [`] or ({[`] or [`]}) or `
330
but not `interpreted` [`] or ({[`] or [`]}) or `
333
`interpreted`-text `interpreted`: text `interpreted`:text `text`'s interpreted
352
`interpreted without closing backquote
357
<problematic id="id2" refid="id1">
359
interpreted without closing backquote
360
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
362
Inline interpreted text or phrase reference start-string without end-string at line 1.
366
totest['references'] = [
373
<reference refname="ref">
382
<reference anonymous="1">
386
ref_, r_, r_e-f_, -ref_, and anonymousref__, but not _ref_
391
<reference refname="ref">
394
<reference refname="r">
397
<reference refname="r_e-f">
400
<reference refname="ref">
403
<reference anonymous="1">
409
totest['phrase_references'] = [
416
<reference refname="phrase reference">
420
`anonymous reference`__
425
<reference anonymous="1">
435
<reference refname="phrase reference across lines">
440
`phrase\`_ reference`_
445
<reference refname="phrase`_ reference">
449
Invalid phrase reference:
451
:role:`phrase reference`_
456
Invalid phrase reference:
458
<problematic id="id2" refid="id1">
459
:role:`phrase reference`_
460
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
462
Mismatch: both interpreted text role prefix and reference suffix at line 3.
465
Invalid phrase reference:
467
`phrase reference`:role:_
472
Invalid phrase reference:
474
<problematic id="id2" refid="id1">
475
`phrase reference`:role:_
476
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
478
Mismatch: both interpreted text role suffix and reference suffix at line 3.
481
`phrase reference_ without closing backquote
486
<problematic id="id2" refid="id1">
489
<reference refname="reference">
491
without closing backquote
492
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
494
Inline interpreted text or phrase reference start-string without end-string at line 1.
497
`anonymous phrase reference__ without closing backquote
502
<problematic id="id2" refid="id1">
505
<reference anonymous="1">
507
without closing backquote
508
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
510
Inline interpreted text or phrase reference start-string without end-string at line 1.
514
totest['inline_targets'] = [
518
Here is _`another target` in some text. And _`yet
519
another target`, spanning lines.
521
_`Here is a TaRgeT` with case and spacial difficulties.
526
<target id="target" name="target">
530
<target id="another-target" name="another target">
532
in some text. And \n\
533
<target id="yet-another-target" name="yet another target">
538
<target id="here-is-a-target" name="here is a target">
540
with case and spacial difficulties.
543
But this isn't a _target; targets require backquotes.
545
And _`this`_ is just plain confusing.
550
But this isn't a _target; targets require backquotes.
553
<problematic id="id2" refid="id1">
555
this`_ is just plain confusing.
556
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
558
Inline target start-string without end-string at line 3.
561
_`inline target without closing backquote
566
<problematic id="id2" refid="id1">
568
inline target without closing backquote
569
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
571
Inline target start-string without end-string at line 1.
575
totest['footnote_reference'] = [
582
<footnote_reference id="id1" refname="1">
591
<footnote_reference auto="1" id="id1">
599
<footnote_reference auto="1" id="id1" refname="label">
607
<footnote_reference auto="*" id="id1">
611
totest['citation_reference'] = [
618
<citation_reference id="id1" refname="citation">
622
[citation]_ and [cit-ation]_ and [cit.ation]_ and [CIT1]_ but not [CIT 1]_
627
<citation_reference id="id1" refname="citation">
630
<citation_reference id="id2" refname="cit-ation">
633
<citation_reference id="id3" refname="cit.ation">
636
<citation_reference id="id4" refname="cit1">
642
totest['substitution_references'] = [
649
<substitution_reference refname="subref">
653
|subref|_ and |subref|__
658
<reference refname="subref">
659
<substitution_reference refname="subref">
662
<reference anonymous="1">
663
<substitution_reference refname="subref">
667
|substitution reference|
672
<substitution_reference refname="substitution reference">
673
substitution reference
682
<substitution_reference refname="substitution reference">
687
|substitution reference without closing verbar
692
<problematic id="id2" refid="id1">
694
substitution reference without closing verbar
695
<system_message backrefs="id2" id="id1" level="2" type="WARNING">
697
Inline substitution_reference start-string without end-string at line 1.
701
totest['standalone_hyperlink'] = [
703
http://www.standalone.hyperlink.com
705
http:/one-slash-only.absolute.path
707
http://[1080:0:0:0:8:800:200C:417A]/IPv6address.html
709
http://[3ffe:2a00:100:7031::1]
711
mailto:someone@somewhere.com
713
news:comp.lang.python
715
An email address in a sentence: someone@somewhere.com.
717
ftp://ends.with.a.period.
719
(a.question.mark@end?)
724
<reference refuri="http://www.standalone.hyperlink.com">
725
http://www.standalone.hyperlink.com
727
<reference refuri="http:/one-slash-only.absolute.path">
728
http:/one-slash-only.absolute.path
730
<reference refuri="http://[1080:0:0:0:8:800:200C:417A]/IPv6address.html">
731
http://[1080:0:0:0:8:800:200C:417A]/IPv6address.html
733
<reference refuri="http://[3ffe:2a00:100:7031::1]">
734
http://[3ffe:2a00:100:7031::1]
736
<reference refuri="mailto:someone@somewhere.com">
737
mailto:someone@somewhere.com
739
<reference refuri="news:comp.lang.python">
740
news:comp.lang.python
742
An email address in a sentence: \n\
743
<reference refuri="mailto:someone@somewhere.com">
744
someone@somewhere.com
747
<reference refuri="ftp://ends.with.a.period">
748
ftp://ends.with.a.period
752
<reference refuri="mailto:a.question.mark@end">
757
None of these are standalone hyperlinks (their "schemes"
758
are not recognized): signal:noise, a:b.
763
None of these are standalone hyperlinks (their "schemes"
764
are not recognized): signal:noise, a:b.
768
totest['miscellaneous'] = [
770
__This__ should be left alone.
775
__This__ should be left alone.
780
if __name__ == '__main__':
782
unittest.main(defaultTest='suite')