updated workflow

This commit is contained in:
sankalp committed 2026-01-30 18:47:43 +05:45
1 parent 98b73c45fb
commit 80059745c3
10 files changed
+97 -90

No files matched your search

+19 -19
View File
@@ -1,8 +1,8 @@
"""
Tests for django-nepkit widgets.
"""
import pytest
from django.forms import Form
from django_nepkit.widgets import (
NepaliDatePickerWidget,
@@ -20,16 +20,16 @@ class TestNepaliDatePickerWidget:
"""Test that widget renders with nepkit-datepicker class."""
widget = NepaliDatePickerWidget()
html = widget.render("birth_date", None)
assert 'class=' in html
assert 'nepkit-datepicker' in html
assert "class=" in html
assert "nepkit-datepicker" in html
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
def test_widget_language_attribute_en(self):
"""Test that widget renders data-en attribute when en=True."""
widget = NepaliDatePickerWidget(en=True)
html = widget.render("birth_date", None)
assert 'data-en="true"' in html
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
@@ -37,7 +37,7 @@ class TestNepaliDatePickerWidget:
"""Test that widget renders data-ne attribute when ne=True."""
widget = NepaliDatePickerWidget(ne=True)
html = widget.render("birth_date", None)
assert 'data-ne="true"' in html
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
@@ -45,15 +45,15 @@ class TestNepaliDatePickerWidget:
"""Test that widget renders data-format attribute."""
widget = NepaliDatePickerWidget()
html = widget.render("birth_date", None)
assert 'data-format=' in html
assert "data-format=" in html
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
def test_widget_autocomplete_off(self):
"""Test that widget has autocomplete=off."""
widget = NepaliDatePickerWidget()
html = widget.render("birth_date", None)
assert 'autocomplete="off"' in html
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
@@ -61,8 +61,8 @@ class TestNepaliDatePickerWidget:
"""Test that widget has placeholder."""
widget = NepaliDatePickerWidget()
html = widget.render("birth_date", None)
assert 'placeholder=' in html
assert "placeholder=" in html
class TestLocationWidgets:
@@ -73,8 +73,8 @@ class TestLocationWidgets:
"""Test that ProvinceSelectWidget renders correctly."""
widget = ProvinceSelectWidget()
html = widget.render("province", None)
assert '<select' in html
assert "<select" in html
assert 'name="province"' in html
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
@@ -82,8 +82,8 @@ class TestLocationWidgets:
"""Test that DistrictSelectWidget renders correctly."""
widget = DistrictSelectWidget()
html = widget.render("district", None)
assert '<select' in html
assert "<select" in html
assert 'name="district"' in html
@pytest.mark.xfail(reason="Django app registry timing issue in test environment")
@@ -91,15 +91,15 @@ class TestLocationWidgets:
"""Test that MunicipalitySelectWidget renders correctly."""
widget = MunicipalitySelectWidget()
html = widget.render("municipality", None)
assert '<select' in html
assert "<select" in html
assert 'name="municipality"' in html
def test_location_widget_htmx_attributes(self):
"""Test that HTMX attributes are added when htmx=True."""
widget = DistrictSelectWidget(htmx=True)
context = widget.get_context("district", None, {})
# Check that widget has HTMX configuration
widget_attrs = context.get("widget", {}).get("attrs", {})
assert "hx-get" in widget_attrs or widget.htmx is True
@@ -109,5 +109,5 @@ class TestLocationWidgets:
"""Test that location widgets respect ne=True."""
widget = ProvinceSelectWidget(ne=True)
html = widget.render("province", None)
assert 'data-ne="true"' in html