code: def test_epub_writing_mode(app):
      # horizontal (default)
      app.build(force_all=True)
  
      # horizontal / page-progression-direction
      opf = EPUBElementTree.fromstring(
          (app.outdir / "content.opf").read_text(encoding="utf8")
      )
      assert (
          opf.find("./idpf:spine").get("page-progression-direction")
          == "ltr"
      )
  
      # horizontal / ibooks:scroll-axis
      metadata = opf.find("./idpf:metadata")
      assert (
          metadata.find(
              "./idpf:meta[@property='ibooks:scroll-axis']"
          ).text
          == "vertical"
      )
  
      # horizontal / writing-mode (CSS)
      css = (app.outdir / "_static" / "epub.css").read_text(
          encoding="utf8"
      )
      assert "writing-mode: horizontal-tb;" in css
  
      # vertical
      app.config.epub_writing_mode = "vertical"
      (app.outdir / "index.xhtml").unlink()  # forcely rebuild
      app.build()
  
      # vertical / page-progression-direction
      opf = EPUBElementTree.fromstring(
          (app.outdir / "content.opf").read_text(encoding="utf8")
      )
      assert (
          opf.find("./idpf:spine").get("page-progression-direction")
          == "rtl"
      )
  
      # vertical / ibooks:scroll-axis
      metadata = opf.find("./idpf:metadata")
      assert (
          metadata.find(
              "./idpf:meta[@property='ibooks:scroll-axis']"
          ).text
          == "horizontal"
      )
  
      # vertical / writing-mode (CSS)
      css = (app.outdir / "_static" / "epub.css").read_text(
          encoding="utf8"
      )
      assert "writing-mode: vertical-rl;" in css
  
imports: import os
  import subprocess
  from pathlib import Path
  from subprocess import CalledProcessError
  from xml.etree import ElementTree
  import pytest
  from sphinx.builders.epub3 import _XML_NAME_PATTERN
label_desc: Use image node_id 6 for calling a global function with example usage: test_epub_writing_mode(app) without return types