File: utils.py

package info (click to toggle)
python-django-crispy-forms 2.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,056 kB
  • sloc: python: 3,078; makefile: 88
file content (19 lines) | stat: -rw-r--r-- 434 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import os
from pathlib import Path

from django.test.html import parse_html

from crispy_forms.utils import render_crispy_form

TEST_DIR = os.path.dirname(os.path.abspath(__file__))


def parse_expected(expected_file):
    test_file = Path(TEST_DIR) / "results" / expected_file
    with test_file.open() as f:
        return parse_html(f.read())


def parse_form(form):
    html = render_crispy_form(form)
    return parse_html(html)