Skip to content

Commit

Permalink
tests: use prettified snapshot for HTML
Browse files Browse the repository at this point in the history
  • Loading branch information
xavfernandez committed Nov 28, 2024
1 parent 899cbea commit 410dbd8
Show file tree
Hide file tree
Showing 3 changed files with 438 additions and 640 deletions.
5 changes: 5 additions & 0 deletions tests/utils/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import openpyxl
import sqlparse
from bs4 import BeautifulSoup
from bs4.formatter import HTMLFormatter
from django.conf import Path, settings
from django.db import DEFAULT_DB_ALIAS, connections
from django.db.backends.utils import CursorDebugWrapper
Expand Down Expand Up @@ -38,6 +39,10 @@
}


def pretty_indented(soup, indent=4):
return soup.prettify(formatter=HTMLFormatter(indent=indent))


def pprint_html(response, **selectors):
"""
Pretty-print HTML responses (or fragment selected with :arg:`selector`)
Expand Down
Loading

0 comments on commit 410dbd8

Please sign in to comment.