From ac2ef17bd37fbe0249c168e56004a22d803dd85f Mon Sep 17 00:00:00 2001 From: erin Date: Wed, 18 Oct 2023 15:59:09 +1000 Subject: [PATCH] Add test for lint checks for missing CSS --- tests/data/lint/c-006-out.txt | 64 ++++++++++++++++++++++++++ tests/data/lint/c-006/chapter-1.xhtml | 44 ++++++++++++++++++ tests/data/lint/c-006/dedication.xhtml | 13 ++++++ tests/data/lint/c-006/epigraph.xhtml | 16 +++++++ tests/data/lint/c-006/local.css | 0 tests/test_lint.py | 2 +- 6 files changed, 138 insertions(+), 1 deletion(-) create mode 100644 tests/data/lint/c-006-out.txt create mode 100644 tests/data/lint/c-006/chapter-1.xhtml create mode 100644 tests/data/lint/c-006/dedication.xhtml create mode 100644 tests/data/lint/c-006/epigraph.xhtml create mode 100644 tests/data/lint/c-006/local.css diff --git a/tests/data/lint/c-006-out.txt b/tests/data/lint/c-006-out.txt new file mode 100644 index 00000000..0f9d4b23 --- /dev/null +++ b/tests/data/lint/c-006-out.txt @@ -0,0 +1,64 @@ +s-033 [Manual Review] chapter-1.xhtml File language is `en-GB`, but +`content.opf` language is `LANG`. +m-036 [Error] colophon.xhtml Variable not replaced with value. + PG_URL + IA_URL + COVER_ARTIST + COVER_ARTIST_WIKI_URL + PRODUCER + PRODUCER_URL + YEAR + PG_YEAR + TRANSCRIBER_1 + TRANSCRIBER_2 + PAINTING +t-064 [Manual Review] colophon.xhtml Title not correctly titlecased. Hint: +Non-English titles should have an `xml:lang` attribute as they have different +titlecasing rules. + PAINTING +m-036 [Error] content.opf Variable not replaced with value. + SUBJECT_1 + SUBJECT_2 + LCSH_ID_1 + LCSH_ID_2 + TAG + DESCRIPTION + LONG_DESCRIPTION + LANG + PG_URL + PRODUCTION_NOTES + EBOOK_WIKI_URL + AUTHOR_SORT + AUTHOR_FULL_NAME + COVER_ARTIST + COVER_ARTIST_SORT + COVER_ARTIST_WIKI_URL + COVER_ARTIST_NACOAF_URI + TRANSCRIBER + TRANSCRIBER_SORT + TRANSCRIBER_URL + PRODUCER + PRODUCER_SORT + PRODUCER_URL +s-020 [Error] content.opf Frontmatter found, but no half title page. Half title +page is required when frontmatter is present. +m-063 [Error] cover.svg Cover image has not been built. +s-033 [Manual Review] dedication.xhtml File language is `en-GB`, but +`content.opf` language is `LANG`. +s-033 [Manual Review] epigraph.xhtml File language is `en-US`, but `content.opf` +language is `LANG`. +m-036 [Error] imprint.xhtml Variable not replaced with value. + PG_URL + IA_URL +c-006 [Error] local.css Semantic found, but missing corresponding style in +`local.css`. + + + +
+
+
+
+
+
+ diff --git a/tests/data/lint/c-006/chapter-1.xhtml b/tests/data/lint/c-006/chapter-1.xhtml new file mode 100644 index 00000000..33eac5b5 --- /dev/null +++ b/tests/data/lint/c-006/chapter-1.xhtml @@ -0,0 +1,44 @@ + + + + I + + + + +
+

I

+

The following abbreviations need CSS styles: AD, C, A.B.C..

+
+

+ Line 1 +
+ +
+ Line 2 +

+
+
+

+ Line 1 +
+ Line 2 +

+
+
+

+ Line 1 +
+ Line 2 +

+
+
+

+ Line 1 +
+ Line 2 +

+
+
+ + diff --git a/tests/data/lint/c-006/dedication.xhtml b/tests/data/lint/c-006/dedication.xhtml new file mode 100644 index 00000000..bc330983 --- /dev/null +++ b/tests/data/lint/c-006/dedication.xhtml @@ -0,0 +1,13 @@ + + + + Dedication + + + + +
+

Dedication.

+
+ + \ No newline at end of file diff --git a/tests/data/lint/c-006/epigraph.xhtml b/tests/data/lint/c-006/epigraph.xhtml new file mode 100644 index 00000000..aa8fc595 --- /dev/null +++ b/tests/data/lint/c-006/epigraph.xhtml @@ -0,0 +1,16 @@ + + + + Epigraph + + + + +
+
+

Quotation

+ Author +
+
+ + diff --git a/tests/data/lint/c-006/local.css b/tests/data/lint/c-006/local.css new file mode 100644 index 00000000..e69de29b diff --git a/tests/test_lint.py b/tests/test_lint.py index 6cc21fb8..bb89e38d 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -7,7 +7,7 @@ from helpers import assemble_book, run, output_is_golden -@pytest.mark.parametrize("test_name", ["clean", "content", "s-058", "glossaries", "elements"]) +@pytest.mark.parametrize("test_name", ["c-006", "clean", "content", "s-058", "glossaries", "elements"]) def test_lint(data_dir: Path, draft_dir: Path, work_dir: Path, capfd, test_name: str, update_golden: bool): """Run lint command on several books with different expected lint output: clean - No errors expected