From e073716437f0ace38a56b711311c8ec7d6463455 Mon Sep 17 00:00:00 2001
From: Frank Sachsenheim <funkyfuture@riseup.net>
Date: Fri, 20 Sep 2024 22:29:31 +0200
Subject: [PATCH] Renames POF to FormatOptions and fixes gram. issue

---
 _delb/nodes.py                                |  55 +++++-----
 delb/__init__.py                              |  22 ++--
 docs/api/serialization.rst                    |  18 ++--
 .../test-parse-serialize-equality.py          |  12 +--
 tests/test_serialization.py                   | 102 ++++++++----------
 5 files changed, 93 insertions(+), 116 deletions(-)

diff --git a/_delb/nodes.py b/_delb/nodes.py
index ed947a35..bae34167 100644
--- a/_delb/nodes.py
+++ b/_delb/nodes.py
@@ -758,9 +758,9 @@ class NodeBase(ABC):
 
     def __str__(self) -> str:
         return self.serialize(
+            format_options=DefaultStringOptions.format_options,
             namespaces=DefaultStringOptions.namespaces,
             newline=DefaultStringOptions.newline,
-            pretty_format_options=DefaultStringOptions.pretty_format_options,
         )
 
     def add_following_siblings(self, *node: NodeSource, clone: bool = False):
@@ -1274,27 +1274,27 @@ def replace_with(self, node: NodeSource, clone: bool = False) -> NodeBase:
     def serialize(
         self,
         *,
+        format_options: Optional[FormatOptions] = None,
         namespaces: Optional[NamespaceDeclarations] = None,
         newline: Optional[str] = None,
-        pretty_format_options: Optional[PrettyFormatOptions] = None,
     ):
         """
         Returns a string that contains the serialization of the node. See
         :doc:`/api/serialization` for details.
 
+        :param format_options: An instance of :class:`FormatOptions` can be provided to
+                               configure formatting.
         :param namespaces: A mapping of prefixes to namespaces. These are overriding
                            possible declarations from a parsed serialisat that the
                            document instance stems from. Prefixes for undeclared
                            namespaces are enumerated with the prefix ``ns``.
         :param newline: See :class:`io.TextIOWrapper` for a detailed explanation of the
                         parameter with the same name.
-        :param pretty_format_options: An instance of :class:`PrettyFormatOptions` can be
-                                      provided to configure formatting.
         """
         serializer = _get_serializer(
             _StringWriter(newline=newline),
+            format_options=format_options,
             namespaces=namespaces,
-            pretty_format_options=pretty_format_options,
         )
         with _wrapper_cache:
             serializer.serialize_node(self)
@@ -2475,14 +2475,14 @@ def _reduce_whitespace_content(
     def serialize(
         self,
         *,
+        format_options: Optional[FormatOptions] = None,
         namespaces: Optional[NamespaceDeclarations] = None,
         newline: Optional[str] = None,
-        pretty_format_options: Optional[PrettyFormatOptions] = None,
     ):
         serializer = _get_serializer(
             _StringWriter(newline=newline),
+            format_options=format_options,
             namespaces=namespaces,
-            pretty_format_options=pretty_format_options,
         )
         with _wrapper_cache:
             serializer.serialize_root(self)
@@ -3115,31 +3115,28 @@ def not_wrapper(node: NodeBase) -> bool:
 
 def _get_serializer(
     writer: _SerializationWriter,
+    format_options: Optional[FormatOptions],
     namespaces: Optional[NamespaceDeclarations],
-    pretty_format_options: Optional[PrettyFormatOptions],
 ) -> Serializer:
-    if pretty_format_options is None:
+    if format_options is None:
         return Serializer(
             writer=writer,
             namespaces=namespaces,
         )
 
-    if (
-        pretty_format_options.indentation
-        and not pretty_format_options.indentation.isspace()
-    ):
+    if format_options.indentation and not format_options.indentation.isspace():
         raise ValueError("Invalid indentation characters.")
 
-    if pretty_format_options.text_width:
+    if format_options.text_width:
         return TextWrappingSerializer(
             writer=writer,
-            pretty_format_options=pretty_format_options,
+            format_options=format_options,
             namespaces=namespaces,
         )
     else:
         return PrettySerializer(
             writer=writer,
-            pretty_format_options=pretty_format_options,
+            format_options=format_options,
             namespaces=namespaces,
         )
 
@@ -3343,13 +3340,13 @@ class PrettySerializer(Serializer):
     def __init__(
         self,
         writer: _SerializationWriter,
-        pretty_format_options: PrettyFormatOptions,
+        format_options: FormatOptions,
         *,
         namespaces: Optional[NamespaceDeclarations] = None,
     ):
         super().__init__(writer, namespaces=namespaces)
-        self._align_attributes = pretty_format_options.align_attributes
-        self.indentation = pretty_format_options.indentation
+        self._align_attributes = format_options.align_attributes
+        self.indentation = format_options.indentation
         self._level = 0
         self._serialization_root: None | TagNode = None
         self._space_preserving_serializer = Serializer(
@@ -3502,22 +3499,22 @@ class TextWrappingSerializer(PrettySerializer):
     def __init__(
         self,
         writer: _SerializationWriter,
-        pretty_format_options: PrettyFormatOptions,
+        format_options: FormatOptions,
         *,
         namespaces: Optional[NamespaceDeclarations] = None,
     ):
-        if pretty_format_options.text_width < 1:
+        if format_options.text_width < 1:
             raise ValueError
         self.writer: _LengthTrackingWriter
         super().__init__(
             writer=_LengthTrackingWriter(writer.buffer),
-            pretty_format_options=pretty_format_options,
+            format_options=format_options,
             namespaces=namespaces,
         )
         self._line_fitting_serializer = _LineFittingSerializer(
             self.writer, namespaces=self._namespaces
         )
-        self._width = pretty_format_options.text_width
+        self._width = format_options.text_width
 
     @property
     def _available_space(self):
@@ -3830,7 +3827,7 @@ def _wrap_text(text: str, width: int) -> Iterator[str]:
             yield text
 
 
-class PrettyFormatOptions(NamedTuple):
+class FormatOptions(NamedTuple):
     """
     Instances of this class can be used to define serialization formatting that is
     not so hard to interpret for instances of Homo sapiens s., but more costly to
@@ -3888,25 +3885,25 @@ class DefaultStringOptions:
     See :class:`io.TextIOWrapper` for a detailed explanation of the parameter with the
     same name.
     """
-    pretty_format_options: ClassWar[None | PrettyFormatOptions] = None
+    format_options: ClassWar[None | FormatOptions] = None
     """
-    An instance of :class:`PrettyFormatOptions` can be provided to configure formatting.
+    An instance of :class:`FormatOptions` can be provided to configure formatting.
     """
 
     @classmethod
     def _get_serializer(cls) -> Serializer:
         return _get_serializer(
             _StringWriter(newline=cls.newline),
+            format_options=cls.format_options,
             namespaces=cls.namespaces,
-            pretty_format_options=cls.pretty_format_options,
         )
 
     @classmethod
     def reset_defaults(cls):
         """Restores the factory settings."""
+        cls.format_options = None
         cls.namespaces = None
         cls.newline = None
-        cls.pretty_format_options = None
 
 
 class _SerializationWriter(ABC):
@@ -3973,8 +3970,8 @@ def __init__(
     Attribute.__name__,
     CommentNode.__name__,
     DefaultStringOptions.__name__,
+    FormatOptions.__name__,
     NodeBase.__name__,
-    PrettyFormatOptions.__name__,
     ProcessingInstructionNode.__name__,
     QueryResults.__name__,
     TagAttributes.__name__,
diff --git a/delb/__init__.py b/delb/__init__.py
index ebe6a8ec..c1ebf0e5 100644
--- a/delb/__init__.py
+++ b/delb/__init__.py
@@ -50,8 +50,8 @@
     tag,
     CommentNode,
     DefaultStringOptions,
+    FormatOptions,
     NodeBase,
-    PrettyFormatOptions,
     PrettySerializer,
     ProcessingInstructionNode,
     Serializer,
@@ -501,9 +501,9 @@ def save(
         pretty: Optional[bool] = None,
         *,
         encoding: str = "utf-8",
+        format_options: Optional[FormatOptions] = None,
         namespaces: Optional[NamespaceDeclarations] = None,
         newline: None | str = None,
-        pretty_format_options: Optional[PrettyFormatOptions] = None,
     ):
         """
         Saves the serialized document contents to a file. See :doc:`/api/serialization`
@@ -513,23 +513,23 @@ def save(
         :param pretty: *Deprecated.* Adds indentation for human consumers when
                        :obj:`True`.
         :param encoding: The desired text encoding.
+        :param format_options: An instance of :class:`FormatOptions` can be
+                               provided to configure formatting.
         :param namespaces: A mapping of prefixes to namespaces. These are overriding
                            possible declarations from a parsed serialisat that the
                            document instance stems from. Prefixes for undeclared
                            namespaces are enumerated with the prefix ``ns``.
         :param newline: See :class:`io.TextIOWrapper` for a detailed explanation of the
                         parameter with the same name.
-        :param pretty_format_options: An instance of :class:`PrettyFormatOptions` can be
-                                      provided to configure formatting.
         """
         with path.open("bw") as file:
             self.write(
                 buffer=file,
                 pretty=pretty,
                 encoding=encoding,
+                format_options=format_options,
                 namespaces=namespaces,
                 newline=newline,
-                pretty_format_options=pretty_format_options,
             )
 
     @altered_default_filters()
@@ -561,9 +561,9 @@ def write(
         pretty: Optional[bool] = None,
         *,
         encoding: str = "utf-8",
+        format_options: Optional[FormatOptions] = None,
         namespaces: Optional[NamespaceDeclarations] = None,
         newline: None | str = None,
-        pretty_format_options: Optional[PrettyFormatOptions] = None,
     ):
         """
         Writes the serialized document contents to a :term:`file-like object`. See
@@ -573,21 +573,21 @@ def write(
         :param pretty: *Deprecated.* Adds indentation for human consumers when
                        :obj:`True`.
         :param encoding: The desired text encoding.
+        :param format_options: An instance of :class:`FormatOptions` can be provided to
+                               configure formatting.
         :param namespaces: A mapping of prefixes to namespaces. These are overriding
                            possible declarations from a parsed serialisat that the
                            document instance stems from. Prefixes for undeclared
                            namespaces are enumerated with the prefix ``ns``.
         :param newline: See :class:`io.TextIOWrapper` for a detailed explanation of the
                         parameter with the same name.
-        :param pretty_format_options: An instance of :class:`PrettyFormatOptions` can be
-                                      provided to configure formatting.
         """
         if pretty is not None:
             warn(
                 "The `pretty` argument is deprecated, for the legacy behaviour provide "
                 "`indentation` as two spaces instead."
             )
-            pretty_format_options = PrettyFormatOptions(
+            format_options = FormatOptions(
                 align_attributes=False, indentation="  " if pretty else "", text_width=0
             )
 
@@ -596,8 +596,8 @@ def write(
                 _TextBufferWriter(
                     TextIOWrapper(buffer), encoding=encoding, newline=newline
                 ),
+                format_options=format_options,
                 namespaces=namespaces,
-                pretty_format_options=pretty_format_options,
             ),
             encoding=encoding,
         )
@@ -617,9 +617,9 @@ def xpath(
     CommentNode.__name__,
     DefaultStringOptions.__name__,
     Document.__name__,
+    FormatOptions.__name__,
     Namespaces.__name__,
     ParserOptions.__name__,
-    PrettyFormatOptions.__name__,
     ProcessingInstructionNode.__name__,
     QueryResults.__name__,
     TagNode.__name__,
diff --git a/docs/api/serialization.rst b/docs/api/serialization.rst
index a091e90d..51a1ca73 100644
--- a/docs/api/serialization.rst
+++ b/docs/api/serialization.rst
@@ -7,10 +7,10 @@ Overview
 *delb* allows users to produce well-readable, content-agnostic XML
 serializations as well-readable as they can get.
 
-The formatting options are controlled with the :class:`delb.PrettyFormatOptions`
-that are either passed to serialization methods like :meth:`delb.Document.save`
-and :meth:`delb.TagNode.serialize` or setting the class property
-:obj:`delb.DefaultStringOptions.pretty_format_options` for any conversions of
+The formatting options are controlled with the :class:`delb.FormatOptions` that
+are either passed to serialization methods like :meth:`delb.Document.save` and
+:meth:`delb.TagNode.serialize` or setting the class property
+:obj:`delb.DefaultStringOptions.format_options` for any conversions of
 documents and nodes to strings (e.g. with :func:`print` or :class:`str`) on the
 general application level. Passing / Setting :obj:`None` lets the serializer
 simply dump a tree's contents to an XML stream without any extra efforts.
@@ -40,8 +40,8 @@ standalone units, neither are the contributed implementations suited for
 derivations nor is the architecture ready for extensions in that regard yet.
 
 
-Example and comparison to other means of production
----------------------------------------------------
+Examples and comparison to other means of production
+----------------------------------------------------
 
 As an example this input is given:
 
@@ -65,7 +65,7 @@ Just indentation, no content wrapping and aligned attributes
 
         document.save(
           path,
-          pretty_format_options = PrettyFormatOptions(
+          format_options = FormatOptions(
             align_attributes=True,
             indentation="  ",
             text_width=0
@@ -93,7 +93,7 @@ With text wrapping
 
         document.save(
           path,
-          pretty_format_options = PrettyFormatOptions(
+          format_options = FormatOptions(
             align_attributes=False,
             indentation="  ",
             text_width=59
@@ -142,7 +142,7 @@ Configuration interfaces
 
 .. autoclass:: delb.DefaultStringOptions
 
-.. autoclass:: delb.PrettyFormatOptions
+.. autoclass:: delb.FormatOptions
    :no-inherited-members:
 
 
diff --git a/integration-tests/test-parse-serialize-equality.py b/integration-tests/test-parse-serialize-equality.py
index af86ac9e..909511b0 100755
--- a/integration-tests/test-parse-serialize-equality.py
+++ b/integration-tests/test-parse-serialize-equality.py
@@ -20,8 +20,8 @@
     compare_trees,
     Document,
     FailedDocumentLoading,
+    FormatOptions,
     ParserOptions,
-    PrettyFormatOptions,
 )
 
 
@@ -57,12 +57,10 @@ def save_and_compare_file(
     origin: Document,
     work_fs: MemoryFS,
     result_file: Path,
-    pretty_format_options: None | PrettyFormatOptions,
+    format_options: None | FormatOptions,
     reduce_whitespace: bool,
 ):
-    if not save_file(
-        origin, work_fs, result_file, pretty_format_options=pretty_format_options
-    ):
+    if not save_file(origin, work_fs, result_file, format_options=format_options):
         return
 
     if (
@@ -106,7 +104,7 @@ def parse_and_serialize_and_compare(src_fs: OSFS, work_fs: MemoryFS, file: Path)
         origin,
         work_fs,
         file.with_stem(f"{file.stem}-tabbed"),
-        PrettyFormatOptions(align_attributes=False, indentation="\t", text_width=0),
+        FormatOptions(align_attributes=False, indentation="\t", text_width=0),
         True,
     )
 
@@ -114,7 +112,7 @@ def parse_and_serialize_and_compare(src_fs: OSFS, work_fs: MemoryFS, file: Path)
         origin,
         work_fs,
         file.with_stem(f"{file.stem}-wrapped"),
-        PrettyFormatOptions(align_attributes=False, indentation="  ", text_width=77),
+        FormatOptions(align_attributes=False, indentation="  ", text_width=77),
         True,
     )
 
diff --git a/tests/test_serialization.py b/tests/test_serialization.py
index c2cf6b01..6d6d5c68 100644
--- a/tests/test_serialization.py
+++ b/tests/test_serialization.py
@@ -9,8 +9,8 @@
     tag,
     DefaultStringOptions,
     Document,
+    FormatOptions,
     ParserOptions,
-    PrettyFormatOptions,
     TextNode,
 )
 from _delb.nodes import DETACHED, Serializer
@@ -42,7 +42,7 @@
     ),
 )
 def test_align_attributes(indentation, out):
-    DefaultStringOptions.pretty_format_options = PrettyFormatOptions(
+    DefaultStringOptions.format_options = FormatOptions(
         align_attributes=True, indentation=indentation, text_width=0
     )
     node = new_tag_node(
@@ -104,7 +104,7 @@ def test_empty_below_default_namespace():
     ),
 )
 def test_indentation(indentation, _in, out):
-    DefaultStringOptions.pretty_format_options = PrettyFormatOptions(
+    DefaultStringOptions.format_options = FormatOptions(
         align_attributes=False, indentation=indentation, text_width=0
     )
     document = Document(_in, parser_options=ParserOptions(reduce_whitespace=True))
@@ -146,7 +146,7 @@ def test_prefix_collection_and_generation(_in, prefixes):
 
 
 @pytest.mark.parametrize(
-    ("pretty_format_options", "out"),
+    ("format_options", "out"),
     (
         (
             None,
@@ -156,7 +156,7 @@ def test_prefix_collection_and_generation(_in, prefixes):
             ),
         ),
         (
-            PrettyFormatOptions(align_attributes=False, indentation="  ", text_width=4),
+            FormatOptions(align_attributes=False, indentation="  ", text_width=4),
             """\
             <?xml version="1.0" encoding="UTF-8"?>
             <text>
@@ -170,17 +170,15 @@ def test_prefix_collection_and_generation(_in, prefixes):
         ),
     ),
 )
-def test_significant_whitespace_is_saved(result_file, pretty_format_options, out):
+def test_significant_whitespace_is_saved(result_file, format_options, out):
     document = Document("<text/>")
     document.root.append_children(tag("hi", ["Hello"]), " ", tag("hi", ["world!"]))
 
     document.reduce_whitespace()
-    document.save(result_file, pretty_format_options=pretty_format_options)
+    document.save(result_file, format_options=format_options)
     result = Document(
         result_file,
-        parser_options=ParserOptions(
-            reduce_whitespace=pretty_format_options is not None
-        ),
+        parser_options=ParserOptions(reduce_whitespace=format_options is not None),
     )
     assert result.root.full_text == "Hello world!"
     assert_equal_trees(document.root, result.root)
@@ -188,12 +186,12 @@ def test_significant_whitespace_is_saved(result_file, pretty_format_options, out
 
 
 @pytest.mark.parametrize(
-    "pretty_format_options",
+    "format_options",
     (
         None,
-        PrettyFormatOptions(align_attributes=True, indentation="", text_width=0),
-        PrettyFormatOptions(align_attributes=False, indentation="  ", text_width=0),
-        PrettyFormatOptions(align_attributes=False, indentation="\t", text_width=89),
+        FormatOptions(align_attributes=True, indentation="", text_width=0),
+        FormatOptions(align_attributes=False, indentation="  ", text_width=0),
+        FormatOptions(align_attributes=False, indentation="\t", text_width=89),
     ),
 )
 @pytest.mark.parametrize(
@@ -226,7 +224,7 @@ def test_significant_whitespace_is_saved(result_file, pretty_format_options, out
 )
 # TODO create node objects in parametrization when the etree element wrapper cache has
 #      been shed off
-def test_single_nodes(pretty_format_options, namespaces, node_constructor, args, out):
+def test_single_nodes(format_options, namespaces, node_constructor, args, out):
     DefaultStringOptions.namespaces = namespaces
     node = node_constructor(*args)
     assert (
@@ -251,7 +249,7 @@ def test_text_document_production(files_path, source, prefix, align_attributes,
 
     document.save(
         result_path,
-        pretty_format_options=PrettyFormatOptions(
+        format_options=FormatOptions(
             align_attributes=align_attributes, indentation="  ", text_width=width
         ),
     )
@@ -346,15 +344,9 @@ def test_text_document_production(files_path, source, prefix, align_attributes,
 def test_text_width(files_path, indentation, text_width, out):
     document = Document(files_path / "marx_manifestws_1848.TEI-P5.xml")
     paragraph = document.xpath("//p")[14]
-    pretty_format_options = PrettyFormatOptions(
-        indentation=indentation, text_width=text_width
-    )
-    DefaultStringOptions.pretty_format_options = pretty_format_options
-    assert (
-        paragraph.serialize(pretty_format_options=pretty_format_options)
-        == str(paragraph)
-        == out
-    )
+    format_options = FormatOptions(indentation=indentation, text_width=text_width)
+    DefaultStringOptions.format_options = format_options
+    assert paragraph.serialize(format_options=format_options) == str(paragraph) == out
 
 
 @pytest.mark.parametrize(
@@ -390,7 +382,7 @@ def test_text_with_milestone_tag(files_path, text_width, expected):
     paragraph = document.css_select("fileDesc sourceDesc p").first
     assert "\t" not in paragraph.full_text
 
-    DefaultStringOptions.pretty_format_options = PrettyFormatOptions(
+    DefaultStringOptions.format_options = FormatOptions(
         indentation="  ", text_width=text_width
     )
     assert str(paragraph) == dedent(expected)
@@ -400,7 +392,7 @@ def test_text_with_milestone_tag(files_path, text_width, expected):
     ("format_options", "_in", "out"),
     (
         (
-            PrettyFormatOptions(align_attributes=False, indentation="", text_width=60),
+            FormatOptions(align_attributes=False, indentation="", text_width=60),
             """<p><lb/>When you shall see especiall cause then give to <lb/>the lady two
             sponefuls &amp; a halfe of the vomyting syrope <lb/>mixed <glyph/></p>""",
             """\
@@ -411,7 +403,7 @@ def test_text_with_milestone_tag(files_path, text_width, expected):
             </p>""",
         ),
         (
-            PrettyFormatOptions(align_attributes=False, indentation="", text_width=77),
+            FormatOptions(align_attributes=False, indentation="", text_width=77),
             """<p><lb/>When you shall see especiall cause <choice><sic>they</sic><corr>then</corr></choice> give to <lb/>the lady two sponefuls &amp; a halfe of the vomyting syrope <lb/>mixed <glyph/></p>""",  # noqa: E501
             """\
             <p>
@@ -421,9 +413,7 @@ def test_text_with_milestone_tag(files_path, text_width, expected):
             </p>""",
         ),
         (
-            PrettyFormatOptions(
-                align_attributes=False, indentation="  ", text_width=77
-            ),
+            FormatOptions(align_attributes=False, indentation="  ", text_width=77),
             """\
             <p>“Come, come!” he said, from his corner. “Don't go on in that way, Mr. Gridley. You are only
              a little low. We are all of us a little low, sometimes. <hi>I</hi> am. Hold up, hold up!
@@ -439,9 +429,7 @@ def test_text_with_milestone_tag(files_path, text_width, expected):
             </p>""",  # noqa: E501
         ),
         (
-            PrettyFormatOptions(
-                align_attributes=False, indentation="  ", text_width=77
-            ),
+            FormatOptions(align_attributes=False, indentation="  ", text_width=77),
             """\
             <layout columns="1" ruledLines="22" writtenLines="21">
                <!--  xml:id="LO16" -->
@@ -460,9 +448,7 @@ def test_text_with_milestone_tag(files_path, text_width, expected):
             </layout>""",  # noqa: E501
         ),
         (
-            PrettyFormatOptions(
-                align_attributes=False, indentation="  ", text_width=77
-            ),
+            FormatOptions(align_attributes=False, indentation="  ", text_width=77),
             """\
             <layout columns="2" ruledLines="23" writtenLines="22">
                <!-- xml:id="LO15??" -->
@@ -480,9 +466,7 @@ def test_text_with_milestone_tag(files_path, text_width, expected):
             </layout>""",  # noqa: E501
         ),
         (
-            PrettyFormatOptions(
-                align_attributes=False, indentation="  ", text_width=77
-            ),
+            FormatOptions(align_attributes=False, indentation="  ", text_width=77),
             """\
             <text>
                <div>
@@ -503,7 +487,7 @@ def test_text_with_milestone_tag(files_path, text_width, expected):
     ),
 )
 def test_text_wrapping(format_options, _in, out):
-    DefaultStringOptions.pretty_format_options = format_options
+    DefaultStringOptions.format_options = format_options
     document = Document(
         dedent(_in), parser_options=ParserOptions(reduce_whitespace=True)
     )
@@ -528,7 +512,7 @@ def test_text_wrapping(format_options, _in, out):
     ),
 )
 @pytest.mark.parametrize(
-    "pretty_format_options",
+    "format_options",
     (
         {"indentation": ""},
         {"indentation": "  "},
@@ -539,11 +523,9 @@ def test_text_wrapping(format_options, _in, out):
         {"indentation": "  ", "text_width": 77},
     ),
 )
-def test_that_no_extra_whitespace_is_produced(_in, pretty_format_options):
+def test_that_no_extra_whitespace_is_produced(_in, format_options):
     parser_options = ParserOptions(reduce_whitespace=True)
-    DefaultStringOptions.pretty_format_options = PrettyFormatOptions(
-        **pretty_format_options
-    )
+    DefaultStringOptions.format_options = FormatOptions(**format_options)
 
     origin = Document(_in, parser_options=parser_options)
     _copy = Document(str(origin.root), parser_options=parser_options)
@@ -552,7 +534,7 @@ def test_that_no_extra_whitespace_is_produced(_in, pretty_format_options):
 
 def test_that_root_siblings_are_preserved(files_path, result_file):
     origin_path = files_path / "root_siblings.xml"
-    Document(origin_path).save(result_file, PrettyFormatOptions())
+    Document(origin_path).save(result_file, FormatOptions())
 
     assert (
         origin_path.read_text()
@@ -572,18 +554,18 @@ def test_that_root_siblings_are_preserved(files_path, result_file):
 @skip_long_running_test
 @pytest.mark.parametrize("file", TEI_FILES)
 @pytest.mark.parametrize(
-    "pretty_format_options",
+    "format_options",
     (
         None,
-        PrettyFormatOptions(align_attributes=False, indentation="", text_width=0),
-        PrettyFormatOptions(align_attributes=False, indentation="  ", text_width=0),
-        PrettyFormatOptions(align_attributes=True, indentation="\t", text_width=0),
-        PrettyFormatOptions(align_attributes=False, indentation="", text_width=77),
-        PrettyFormatOptions(align_attributes=False, indentation="  ", text_width=77),
-        PrettyFormatOptions(align_attributes=True, indentation="  ", text_width=77),
+        FormatOptions(align_attributes=False, indentation="", text_width=0),
+        FormatOptions(align_attributes=False, indentation="  ", text_width=0),
+        FormatOptions(align_attributes=True, indentation="\t", text_width=0),
+        FormatOptions(align_attributes=False, indentation="", text_width=77),
+        FormatOptions(align_attributes=False, indentation="  ", text_width=77),
+        FormatOptions(align_attributes=True, indentation="  ", text_width=77),
     ),
 )
-def test_transparency(file, pretty_format_options, result_file):
+def test_transparency(file, format_options, result_file):
     """
     Tests that a serialization of a document will be parsed back to the identical
     document representation. (Prologue and epilogue are ignored here as whitespace is
@@ -597,9 +579,9 @@ def test_transparency(file, pretty_format_options, result_file):
     scale. Thus anything caught there should be added to the `tei_*.xml` files here to
     for further investigations.
     """
-    parser_options = ParserOptions(reduce_whitespace=pretty_format_options is not None)
+    parser_options = ParserOptions(reduce_whitespace=format_options is not None)
     origin = Document(file, parser_options=parser_options)
-    origin.save(result_file, pretty_format_options=pretty_format_options)
+    origin.save(result_file, format_options=format_options)
     _copy = Document(result_file, parser_options=parser_options)
     assert_equal_trees(origin.root, _copy.root)
 
@@ -617,7 +599,7 @@ def test_transparency(file, pretty_format_options, result_file):
             </root>""",
         ),
         (
-            PrettyFormatOptions().text_width,
+            FormatOptions().text_width,
             """\
             <root>
               <a/>A <b xml:space="preserve"><x/><y/><z/></b> Z<c/>
@@ -626,7 +608,7 @@ def test_transparency(file, pretty_format_options, result_file):
     ),
 )
 def test_xml_space(text_width, out):
-    DefaultStringOptions.pretty_format_options = PrettyFormatOptions(
+    DefaultStringOptions.format_options = FormatOptions(
         indentation="  ", text_width=text_width
     )
 
@@ -651,6 +633,6 @@ def test_xml_space(text_width, out):
         )
 
     # and the application's default behaviour is determined by formatting options
-    DefaultStringOptions.pretty_format_options = None
+    DefaultStringOptions.format_options = None
     root = Document('<root xml:space="default"><t/></root>').root
     assert str(root) == '<root xml:space="default"><t/></root>'