# Path: bulma/tests/utils.py
# def render_form(form):
#     return render_template(
#         """
#         {% extends 'bulma/base.html' %}
#         {% load bulma_tags %}
#         
#         {% block content %}
#           <form method="post" enctype="multipart/form-data" action="." novalidate>
#             {% csrf_token %}
#             {{ form|bulma }}
#             <button class="button is-primary">Submit</button>
#           </form>
#         {% endblock %}
#         """, context={
#             'form': form
#         }
#     )
# 
# def get_dom(html):
#     return BeautifulSoup(html, 'html.parser')
# 
# def element_has_all_attributes(element, attributes):
#     for attribute_name, attribute_value in attributes.items():
#         assert element.has_attr(attribute_name) is True
#         print(element.get(attribute_name))
#         assert element.get(attribute_name) == attribute_value, f'Element {element} has attribute "{attribute_name}" with value {attribute_value}'
#             #return False
#     #return True


import pytest
from django import forms
from .utils import render_form, get_dom, element_has_all_attributes
        choices=COLOR_CHOICES,
        widget=forms.CheckboxSelectMultiple()
    ), "Checkboxes", 'input', {
         'name': 'input',
         'type': 'checkbox',
         'value': 'red'
     }),
    (forms.ChoiceField(
        choices=COLOR_CHOICES,
        widget=forms.RadioSelect()
    ), "Radios", 'input', {
         'name': 'input',
         'type': 'radio',
         'value': 'red'
     }),
    (forms.FileField(), "File input", 'input', {
        'name': 'input',
        'type': 'file',
        'class': ['file-input']
    })
])
def test_input_rendering(field, tag, label, attributes):
    class TestForm(forms.Form):
        input = field

        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)
            self.fields['input'].label = label

    output = render_form(TestForm())

# Path: bulma/tests/utils.py
# def render_form(form):
#     return render_template(
#         """
#         {% extends 'bulma/base.html' %}
#         {% load bulma_tags %}
#         
#         {% block content %}
#           <form method="post" enctype="multipart/form-data" action="." novalidate>
#             {% csrf_token %}
#             {{ form|bulma }}
#             <button class="button is-primary">Submit</button>
#           </form>
#         {% endblock %}
#         """, context={
#             'form': form
#         }
#     )
# 
# def get_dom(html):
#     return BeautifulSoup(html, 'html.parser')
# 
# def element_has_all_attributes(element, attributes):
#     for attribute_name, attribute_value in attributes.items():
#         assert element.has_attr(attribute_name) is True
#         print(element.get(attribute_name))
#         assert element.get(attribute_name) == attribute_value, f'Element {element} has attribute "{attribute_name}" with value {attribute_value}'
#             #return False
#     #return True


# Path: bulma/tests/test_inputs.py
import pytest
from django import forms
from .utils import render_form, get_dom, element_has_all_attributes

        choices=COLOR_CHOICES,
        widget=forms.CheckboxSelectMultiple()
    ), "Checkboxes", 'input', {
         'name': 'input',
         'type': 'checkbox',
         'value': 'red'
     }),
    (forms.ChoiceField(
        choices=COLOR_CHOICES,
        widget=forms.RadioSelect()
    ), "Radios", 'input', {
         'name': 'input',
         'type': 'radio',
         'value': 'red'
     }),
    (forms.FileField(), "File input", 'input', {
        'name': 'input',
        'type': 'file',
        'class': ['file-input']
    })
])
def test_input_rendering(field, tag, label, attributes):
    class TestForm(forms.Form):
        input = field

        def __init__(self, *args, **kwargs):
            super().__init__(*args, **kwargs)
            self.fields['input'].label = label

    output = render_form(TestForm())

    dom = get_dom(output)