File: numbering.py

package info (click to toggle)
python-docx 1.2.0%2Bdfsg-1~exp1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 7,216 kB
  • sloc: xml: 25,323; python: 23,414; makefile: 175
file content (32 lines) | stat: -rw-r--r-- 952 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"""Step implementations for numbering-related features."""

from behave import given, then, when

from docx import Document

from helpers import test_docx

# given ===================================================


@given("a document having a numbering part")
def given_a_document_having_a_numbering_part(context):
    context.document = Document(test_docx("num-having-numbering-part"))


# when ====================================================


@when("I get the numbering part from the document")
def when_get_numbering_part_from_document(context):
    document = context.document
    context.numbering_part = document.part.numbering_part


# then =====================================================


@then("the numbering part has the expected numbering definitions")
def then_numbering_part_has_expected_numbering_definitions(context):
    numbering_part = context.numbering_part
    assert len(numbering_part.numbering_definitions) == 10