mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2026-09-03 20:52:55 -05:00
Fix #2012 exception occurred if `numfig_format` is invalid
This commit is contained in:
@@ -48,3 +48,5 @@ test-tocdepth
|
||||
* Table.2.2 is :numref:`Table:%s <table22>`
|
||||
* List.1 is :numref:`CODE_1`
|
||||
* List.2.2 is :numref:`Code-%s <CODE22>`
|
||||
* Invalid numfig_format 01: :numref:`invalid <fig1>`
|
||||
* Invalid numfig_format 02: :numref:`Fig %s %s <fig1>`
|
||||
|
||||
@@ -488,6 +488,9 @@ def test_tocdepth_singlehtml(app, status, warning):
|
||||
def test_numfig_disabled(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
assert 'WARNING: invalid numfig_format: invalid' not in warning.getvalue()
|
||||
assert 'WARNING: invalid numfig_format: Fig %s %s' not in warning.getvalue()
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
@@ -547,6 +550,9 @@ def test_numfig_without_numbered_toctree(app, status, warning):
|
||||
(app.srcdir / 'index.rst').write_text(index, encoding='utf-8')
|
||||
app.builder.build_all()
|
||||
|
||||
assert 'WARNING: invalid numfig_format: invalid' in warning.getvalue()
|
||||
assert 'WARNING: invalid numfig_format: Fig %s %s' in warning.getvalue()
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
@@ -642,6 +648,9 @@ def test_numfig_without_numbered_toctree(app, status, warning):
|
||||
def test_numfig_with_numbered_toctree(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
assert 'WARNING: invalid numfig_format: invalid' in warning.getvalue()
|
||||
assert 'WARNING: invalid numfig_format: Fig %s %s' in warning.getvalue()
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
@@ -740,6 +749,9 @@ def test_numfig_with_numbered_toctree(app, status, warning):
|
||||
def test_numfig_with_prefix(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
assert 'WARNING: invalid numfig_format: invalid' in warning.getvalue()
|
||||
assert 'WARNING: invalid numfig_format: Fig %s %s' in warning.getvalue()
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
@@ -835,6 +847,9 @@ def test_numfig_with_prefix(app, status, warning):
|
||||
def test_numfig_with_secnum_depth(app, status, warning):
|
||||
app.builder.build_all()
|
||||
|
||||
assert 'WARNING: invalid numfig_format: invalid' in warning.getvalue()
|
||||
assert 'WARNING: invalid numfig_format: Fig %s %s' in warning.getvalue()
|
||||
|
||||
expects = {
|
||||
'index.html': [
|
||||
(".//div[@class='figure']/p[@class='caption']/"
|
||||
|
||||
Reference in New Issue
Block a user