Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_numbering_sectioning_map_error():
init()
meta = getMeta3()
sectioning(meta)
src = Para(createListStr(u'Exercise #'))
dest = Para([
Span(
[u'exercise:1', ['pandoc-numbering-text', 'exercise'], []],
[Strong(createListStr(u'Exercise 1'))]
)
])
assert pandoc_numbering.numbering(src['t'], src['c'], '', meta) == dest
def test_numbering_sectioning_string():
init()
meta = getMeta1()
sectioning(meta)
src = Para(createListStr(u'Exercise #'))
dest = Para([
Span(
[u'exercise:2.2.1', ['pandoc-numbering-text', 'exercise'], []],
[Strong(createListStr(u'Exercise 2.1'))]
)
])
assert pandoc_numbering.numbering(src['t'], src['c'], '', meta) == dest
def test_numbering_sectioning_map():
init()
meta = getMeta2()
sectioning(meta)
src = Para([Str(u'Exercise'), Space(), Str(u'#')])
dest = Para([
Span(
[u'exercise:2.2.1', ['pandoc-numbering-text', 'exercise'], []],
[Strong(createListStr(u'Exercise 2.1'))]
)
])
assert pandoc_numbering.numbering(src['t'], src['c'], '', meta) == dest
def test_numbering_double():
init()
src = Para(createListStr(u'Exercise #'))
pandoc_numbering.numbering(src['t'], src['c'], '', {})
src = Para(createListStr(u'Exercise #'))
dest = Para([
Span(
[u'exercise:2', ['pandoc-numbering-text', 'exercise'], []],
[Strong(createListStr(u'Exercise 2'))]
)
])
assert pandoc_numbering.numbering(src['t'], src['c'], '', {}) == dest
def test_numbering():
init()
src = Para(createListStr(u'Exercise #'))
dest = Para([
Span(
[u'exercise:1', ['pandoc-numbering-text', 'exercise'], []],
[Strong(createListStr(u'Exercise 1'))]
)
])
assert pandoc_numbering.numbering(src['t'], src['c'], '', {}) == dest
def test_classes():
init()
meta = getMeta4()
src = Para(createListStr(u'Exercise #'))
dest = Para([
Span(
[u'exercise:1', ['pandoc-numbering-text', 'my-class'], []],
[Strong(createListStr(u'Exercise 1'))]
)
])
assert pandoc_numbering.numbering(src['t'], src['c'], '', meta) == dest
def test_numbering_title():
init()
src = Para(createListStr(u'Exercise (The title) #'))
dest = Para([
Span(
[u'exercise:1', ['pandoc-numbering-text', 'exercise'], []],
[
Strong(createListStr(u'Exercise 1')),
Space(),
Emph(createListStr(u'(') + createListStr(u'The title') + createListStr(u')'))
]
)
])
assert pandoc_numbering.numbering(src['t'], src['c'], '', {}) == dest
Span(
[u'exercise:1.1.2', ['pandoc-numbering-text', 'exercise'], []],
[Strong(createListStr(u'Exercise 1.1.2'))]
)
])
assert pandoc_numbering.numbering(src['t'], src['c'], '', {}) == dest
src = Header(2, [u'second-section', [], []], createListStr(u'Second section'))
pandoc_numbering.numbering(src['t'], src['c'], '', {})
src = Para(createListStr(u'Exercise +.+.#'))
dest = Para([
Span(
[u'exercise:1.2.1', ['pandoc-numbering-text', 'exercise'], []],
[Strong(createListStr(u'Exercise 1.2.1'))]
)
])
assert pandoc_numbering.numbering(src['t'], src['c'], '', {}) == dest
src = DefinitionList([
[
createListStr(u'Exercise #'),
[Plain([createListStr(u'Content A')])]
],
[
createListStr(u'Exercise #'),
[Plain([createListStr(u'Content B')])]
]
])
dest = DefinitionList([
[
[Span(
[u'exercise:1', ['pandoc-numbering-text', 'exercise'], []],
[Strong(createListStr(u'Exercise 1'))]
)],
[Plain([createListStr(u'Content A')])]
],
[
[Span(
[u'exercise:2', ['pandoc-numbering-text', 'exercise'], []],
[Strong(createListStr(u'Exercise 2'))]
)],
[Plain([createListStr(u'Content B')])]
]
])
assert pandoc_numbering.numbering(src['t'], src['c'], '', {}) == dest
def tobullet(term, defs):
return([Para([Strong(term)])] + [b for d in defs for b in d])