mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Move XML Name pattern to `epub3`
This commit is contained in:
@@ -7,6 +7,8 @@ from xml.etree import ElementTree
|
||||
|
||||
import pytest
|
||||
|
||||
from sphinx.builders.epub3 import _XML_NAME_PATTERN
|
||||
|
||||
|
||||
# check given command is runnable
|
||||
def runnable(command):
|
||||
@@ -382,3 +384,9 @@ def test_run_epubcheck(app):
|
||||
print(exc.stdout.decode('utf-8'))
|
||||
print(exc.stderr.decode('utf-8'))
|
||||
raise AssertionError('epubcheck exited with return code %s' % exc.returncode)
|
||||
|
||||
|
||||
def test_xml_name_pattern_check():
|
||||
assert _XML_NAME_PATTERN.match('id-pub')
|
||||
assert _XML_NAME_PATTERN.match('webpage')
|
||||
assert not _XML_NAME_PATTERN.match('1bfda21')
|
||||
|
||||
@@ -6,7 +6,7 @@ import tempfile
|
||||
import pytest
|
||||
|
||||
from sphinx.errors import ExtensionError
|
||||
from sphinx.util import encode_uri, ensuredir, import_object, parselinenos, xmlname_checker
|
||||
from sphinx.util import encode_uri, ensuredir, import_object, parselinenos
|
||||
|
||||
|
||||
def test_encode_uri():
|
||||
@@ -75,10 +75,3 @@ def test_parselinenos():
|
||||
parselinenos('-', 10)
|
||||
with pytest.raises(ValueError):
|
||||
parselinenos('3-1', 10)
|
||||
|
||||
|
||||
def test_xmlname_check():
|
||||
checker = xmlname_checker()
|
||||
assert checker.match('id-pub')
|
||||
assert checker.match('webpage')
|
||||
assert not checker.match('1bfda21')
|
||||
|
||||
Reference in New Issue
Block a user