Skip to content

Commit

Permalink
fix(text): Capitalize "type" in non-ASCII artwork message (#1170)
Browse files Browse the repository at this point in the history
* chore: Run yestests pre-changes

* fix(text): Capitalize "type" in non-ASCII artwork message

Fixes #1169

* chore: Run yestests post-changes
  • Loading branch information
kesara authored Sep 30, 2024
1 parent f297f11 commit 83e897f
Show file tree
Hide file tree
Showing 16 changed files with 94 additions and 50 deletions.
47 changes: 45 additions & 2 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,18 +712,61 @@ def test_render_artwork_svg_only(self):
self.writer.rfcnumber = 1234
lines = self.writer.render_artwork(artwork, width=60)
text = ''.join(line.text for line in lines)
self.assertIn("Artwork only available as svg", text)
self.assertIn("Artwork only available as SVG", text)
self.assertIn(default_options.rfc_html_archive_url, text)
self.assertIn('rfc1234.html', text)

# for Draft
self.writer.options.rfc = None
lines = self.writer.render_artwork(artwork, width=60)
text = ' '.join(line.text for line in lines)
self.assertIn("Artwork only available as svg", text)
self.assertIn("Artwork only available as SVG", text)
self.assertIn(default_options.id_html_archive_url, text)
self.assertIn(".html", text)

def test_render_artwork_binary_art_only(self):
artwork_str = '<artwork type="binary-art" src="foot.bin" />'
artwork = lxml.etree.fromstring(artwork_str)

# for RFC
self.writer.root = lxml.etree.fromstring(f'<rfc number="1234"></rfc>')
self.writer.options.rfc = True
self.writer.rfcnumber = 1234
lines = self.writer.render_artwork(artwork, width=60)
text = ''.join(line.text for line in lines)
self.assertIn("Artwork only available as BINARY-ART", text)
self.assertIn(default_options.rfc_html_archive_url, text)
self.assertIn('rfc1234.html', text)

# for Draft
self.writer.options.rfc = None
lines = self.writer.render_artwork(artwork, width=60)
text = ' '.join(line.text for line in lines)
self.assertIn("Artwork only available as BINARY-ART", text)
self.assertIn(default_options.id_html_archive_url, text)
self.assertIn(".html", text)

def test_render_artwork_non_ascii_unknown(self):
artwork_str = '<artwork src="foot.bin" />'
artwork = lxml.etree.fromstring(artwork_str)

# for RFC
self.writer.root = lxml.etree.fromstring(f'<rfc number="1234"></rfc>')
self.writer.options.rfc = True
self.writer.rfcnumber = 1234
lines = self.writer.render_artwork(artwork, width=60)
text = ''.join(line.text for line in lines)
self.assertIn("Artwork only available as (unknown type)", text)
self.assertIn(default_options.rfc_html_archive_url, text)
self.assertIn('rfc1234.html', text)

# for Draft
self.writer.options.rfc = None
lines = self.writer.render_artwork(artwork, width=60)
text = ' '.join(line.text for line in lines)
self.assertIn("Artwork only available as (unknown type)", text)
self.assertIn(default_options.id_html_archive_url, text)
self.assertIn(".html", text)


class BaseV3WriterTest(unittest.TestCase):
Expand Down
10 changes: 5 additions & 5 deletions tests/valid/draft-v3-features.text
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,7 @@ Table of Contents

Text before...

(Artwork only available as svg: see
(Artwork only available as SVG: see
https://www.ietf.org/archive/id/draft-v3-features.html)

Text after...
Expand All @@ -528,7 +528,7 @@ Table of Contents

Text before...

(Artwork only available as svg: see
(Artwork only available as SVG: see
https://www.ietf.org/archive/id/draft-v3-features.html)

Text after...
Expand All @@ -537,7 +537,7 @@ Table of Contents

Text before...

(Artwork only available as svg: see
(Artwork only available as SVG: see
https://www.ietf.org/archive/id/draft-v3-features.html)

Text after...
Expand All @@ -546,14 +546,14 @@ Table of Contents

Text before...

(Artwork only available as svg: see
(Artwork only available as SVG: see
https://www.ietf.org/archive/id/draft-v3-features.html)

Text after...

8.5. included (type svg)

(Artwork only available as svg: see
(Artwork only available as SVG: see
https://www.ietf.org/archive/id/draft-v3-features.html)
+--------------------+
| Included from file |
Expand Down
4 changes: 2 additions & 2 deletions tests/valid/elements.bom.text
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,12 @@ Internet-Draft Xml2rfc Vocabulary V3 Elements July 2018

* Artset include with <xi:include>

(Artwork only available as svg: see
(Artwork only available as SVG: see
https://www.ietf.org/archive/id/elements-00.html)

* Unicode SVG rendering test

(Artwork only available as svg: see
(Artwork only available as SVG: see
https://www.ietf.org/archive/id/elements-00.html)

4. Ordered list with sub-elements
Expand Down
4 changes: 2 additions & 2 deletions tests/valid/elements.pages.text
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,12 @@ Internet-Draft Xml2rfc Vocabulary V3 Elements July 2018

* Artset include with <xi:include>

(Artwork only available as svg: see
(Artwork only available as SVG: see
https://www.ietf.org/archive/id/elements-00.html)

* Unicode SVG rendering test

(Artwork only available as svg: see
(Artwork only available as SVG: see
https://www.ietf.org/archive/id/elements-00.html)

4. Ordered list with sub-elements
Expand Down
4 changes: 2 additions & 2 deletions tests/valid/elements.text
Original file line number Diff line number Diff line change
Expand Up @@ -302,12 +302,12 @@ Table of Contents

* Artset include with <xi:include>

(Artwork only available as svg: see
(Artwork only available as SVG: see
https://www.ietf.org/archive/id/elements-00.html)

* Unicode SVG rendering test

(Artwork only available as svg: see
(Artwork only available as SVG: see
https://www.ietf.org/archive/id/elements-00.html)

4. Ordered list with sub-elements
Expand Down
4 changes: 2 additions & 2 deletions tests/valid/elements.wip.text
Original file line number Diff line number Diff line change
Expand Up @@ -355,12 +355,12 @@ Internet-Draft Xml2rfc Vocabulary V3 Elements July 2018

* Artset include with <xi:include>

(Artwork only available as svg: see
(Artwork only available as SVG: see
https://www.ietf.org/archive/id/elements-00.html)

* Unicode SVG rendering test

(Artwork only available as svg: see
(Artwork only available as SVG: see
https://www.ietf.org/archive/id/elements-00.html)

4. Ordered list with sub-elements
Expand Down
12 changes: 6 additions & 6 deletions tests/valid/indexes.pages.text
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@


Network Working Group H. Person, Ed.
Internet-Draft September 20, 2024
Internet-Draft September 26, 2024
Intended status: Experimental
Expires: March 24, 2025
Expires: March 30, 2025


xml2rfc index tests
Expand All @@ -26,7 +26,7 @@ Status of This Memo
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."

This Internet-Draft will expire on March 24, 2025.
This Internet-Draft will expire on March 30, 2025.

Copyright Notice

Expand All @@ -53,7 +53,7 @@ Table of Contents



Person Expires March 24, 2025 [Page 1]
Person Expires March 30, 2025 [Page 1]

Internet-Draft xml2rfc index tests September 2024

Expand Down Expand Up @@ -109,7 +109,7 @@ Index



Person Expires March 24, 2025 [Page 2]
Person Expires March 30, 2025 [Page 2]

Internet-Draft xml2rfc index tests September 2024

Expand Down Expand Up @@ -165,4 +165,4 @@ Author's Address



Person Expires March 24, 2025 [Page 3]
Person Expires March 30, 2025 [Page 3]
6 changes: 3 additions & 3 deletions tests/valid/indexes.prepped.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" sortRefs="true" category="exp" submissionType="independent" ipr="trust200902" docName="indexes-00" indexInclude="true" prepTime="2024-09-20T06:09:45" scripts="Common,Latin" symRefs="true" tocDepth="3" tocInclude="true">
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" sortRefs="true" category="exp" submissionType="independent" ipr="trust200902" docName="indexes-00" indexInclude="true" prepTime="2024-09-26T21:56:36" scripts="Common,Latin" symRefs="true" tocDepth="3" tocInclude="true">
<!-- xml2rfc v2v3 conversion 3.23.1 -->


Expand All @@ -20,7 +20,7 @@
</postal>
</address>
</author>
<date day="20" month="09" year="2024"/>
<date day="26" month="09" year="2024"/>
<boilerplate>
<section anchor="status-of-memo" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.1">
<name slugifiedName="name-status-of-this-memo">Status of This Memo</name>
Expand All @@ -41,7 +41,7 @@
material or to cite them other than as "work in progress."
</t>
<t indent="0" pn="section-boilerplate.1-4">
This Internet-Draft will expire on 24 March 2025.
This Internet-Draft will expire on 30 March 2025.
</t>
</section>
<section anchor="copyright" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.2">
Expand Down
6 changes: 3 additions & 3 deletions tests/valid/indexes.text
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@


Network Working Group H. Person, Ed.
Internet-Draft September 20, 2024
Internet-Draft September 26, 2024
Intended status: Experimental
Expires: March 24, 2025
Expires: March 30, 2025


xml2rfc index tests
Expand All @@ -26,7 +26,7 @@ Status of This Memo
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."

This Internet-Draft will expire on March 24, 2025.
This Internet-Draft will expire on March 30, 2025.

Copyright Notice

Expand Down
8 changes: 4 additions & 4 deletions tests/valid/indexes.v3.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
</tr></thead>
<tfoot><tr>
<td class="left">Person</td>
<td class="center">Expires March 24, 2025</td>
<td class="center">Expires March 30, 2025</td>
<td class="right">[Page]</td>
</tr></tfoot>
</table>
Expand All @@ -36,12 +36,12 @@
<dd class="internet-draft">indexes-00</dd>
<dt class="label-published">Published:</dt>
<dd class="published">
<time datetime="2024-09-20" class="published">September 20, 2024</time>
<time datetime="2024-09-26" class="published">September 26, 2024</time>
</dd>
<dt class="label-intended-status">Intended Status:</dt>
<dd class="intended-status">Experimental</dd>
<dt class="label-expires">Expires:</dt>
<dd class="expires"><time datetime="2025-03-24">March 24, 2025</time></dd>
<dd class="expires"><time datetime="2025-03-30">March 30, 2025</time></dd>
<dt class="label-authors">Author:</dt>
<dd class="authors">
<div class="author">
Expand Down Expand Up @@ -71,7 +71,7 @@ <h2 id="name-status-of-this-memo">
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."<a href="#section-boilerplate.1-3" class="pilcrow"></a></p>
<p id="section-boilerplate.1-4">
This Internet-Draft will expire on March 24, 2025.<a href="#section-boilerplate.1-4" class="pilcrow"></a></p>
This Internet-Draft will expire on March 30, 2025.<a href="#section-boilerplate.1-4" class="pilcrow"></a></p>
</section>
</div>
<div id="copyright">
Expand Down
2 changes: 1 addition & 1 deletion tests/valid/manpage.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
xml2rfc(1) xml2rfc(1)
20 September 2024
26 September 2024


Xml2rfc Vocabulary Version 3 Schema
Expand Down
14 changes: 7 additions & 7 deletions tests/valid/sourcecode.pages.text
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@


Network Working Group H. Person, Ed.
Internet-Draft September 20, 2024
Internet-Draft September 26, 2024
Intended status: Experimental
Expires: March 24, 2025
Expires: March 30, 2025


xml2rfc sourcecode tests
Expand All @@ -26,7 +26,7 @@ Status of This Memo
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."

This Internet-Draft will expire on March 24, 2025.
This Internet-Draft will expire on March 30, 2025.

Copyright Notice

Expand All @@ -53,7 +53,7 @@ Table of Contents



Person Expires March 24, 2025 [Page 1]
Person Expires March 30, 2025 [Page 1]

Internet-Draft xml2rfc sourcecode tests September 2024

Expand Down Expand Up @@ -109,7 +109,7 @@ Internet-Draft xml2rfc sourcecode tests September 2024



Person Expires March 24, 2025 [Page 2]
Person Expires March 30, 2025 [Page 2]

Internet-Draft xml2rfc sourcecode tests September 2024

Expand Down Expand Up @@ -165,7 +165,7 @@ Internet-Draft xml2rfc sourcecode tests September 2024



Person Expires March 24, 2025 [Page 3]
Person Expires March 30, 2025 [Page 3]

Internet-Draft xml2rfc sourcecode tests September 2024

Expand Down Expand Up @@ -221,4 +221,4 @@ Author's Address



Person Expires March 24, 2025 [Page 4]
Person Expires March 30, 2025 [Page 4]
6 changes: 3 additions & 3 deletions tests/valid/sourcecode.prepped.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version='1.0' encoding='utf-8'?>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" sortRefs="true" category="exp" submissionType="independent" ipr="trust200902" docName="sourcecode-00" prepTime="2024-09-20T06:09:52" indexInclude="true" scripts="Common,Latin" symRefs="true" tocDepth="3" tocInclude="true">
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" version="3" sortRefs="true" category="exp" submissionType="independent" ipr="trust200902" docName="sourcecode-00" prepTime="2024-09-26T21:56:43" indexInclude="true" scripts="Common,Latin" symRefs="true" tocDepth="3" tocInclude="true">
<!-- xml2rfc v2v3 conversion 3.23.1 -->


Expand All @@ -20,7 +20,7 @@
</postal>
</address>
</author>
<date day="20" month="09" year="2024"/>
<date day="26" month="09" year="2024"/>
<boilerplate>
<section anchor="status-of-memo" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.1">
<name slugifiedName="name-status-of-this-memo">Status of This Memo</name>
Expand All @@ -41,7 +41,7 @@
material or to cite them other than as "work in progress."
</t>
<t indent="0" pn="section-boilerplate.1-4">
This Internet-Draft will expire on 24 March 2025.
This Internet-Draft will expire on 30 March 2025.
</t>
</section>
<section anchor="copyright" numbered="false" removeInRFC="false" toc="exclude" pn="section-boilerplate.2">
Expand Down
6 changes: 3 additions & 3 deletions tests/valid/sourcecode.text
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@


Network Working Group H. Person, Ed.
Internet-Draft September 20, 2024
Internet-Draft September 26, 2024
Intended status: Experimental
Expires: March 24, 2025
Expires: March 30, 2025


xml2rfc sourcecode tests
Expand All @@ -26,7 +26,7 @@ Status of This Memo
time. It is inappropriate to use Internet-Drafts as reference
material or to cite them other than as "work in progress."

This Internet-Draft will expire on March 24, 2025.
This Internet-Draft will expire on March 30, 2025.

Copyright Notice

Expand Down
Loading

0 comments on commit 83e897f

Please sign in to comment.