# Path: tests/models.py
# class FieldModel(models.Model):
#     url = URLField(null=True, blank=True)
#     multichoice = MultipleChoiceField(
#         max_length=255,
#         null=True,
#         blank=True,
#         choices=[("1", "1"), ("2", "2"), ("3", "3")],
#     )
# 
#     class Meta:
#         app_label = "django_peeringdb.tests"
# 
# class LG_FieldModel(models.Model):
#     url = LG_URLField(null=True, blank=True)
# 
#     class Meta:
#         app_label = "django_peeringdb.tests"


import pytest
from django.core.exceptions import ValidationError
from django.test import TestCase
from django_peeringdb.models import LG_URLField, URLField
from tests.models import FieldModel, LG_FieldModel



class FieldTests(TestCase):
    """test model functionality"""

    def test_init(self):
        URLField()

    def test_url(self):
        model = FieldModel()

        model.url = "http://example.com"
        model.full_clean()

        model.url = "https://example.com"
        model.full_clean()

        with pytest.raises(ValidationError):
            model.url = "invalid"
            model.full_clean()

    def test_multichoice(self):

# Path: tests/models.py
# class FieldModel(models.Model):
#     url = URLField(null=True, blank=True)
#     multichoice = MultipleChoiceField(
#         max_length=255,
#         null=True,
#         blank=True,
#         choices=[("1", "1"), ("2", "2"), ("3", "3")],
#     )
# 
#     class Meta:
#         app_label = "django_peeringdb.tests"
# 
# class LG_FieldModel(models.Model):
#     url = LG_URLField(null=True, blank=True)
# 
#     class Meta:
#         app_label = "django_peeringdb.tests"


# Path: tests/test_models.py
import pytest
from django.core.exceptions import ValidationError
from django.test import TestCase
from django_peeringdb.models import LG_URLField, URLField
from tests.models import FieldModel, LG_FieldModel




class FieldTests(TestCase):
    """test model functionality"""

    def test_init(self):
        URLField()

    def test_url(self):
        model = FieldModel()

        model.url = "http://example.com"
        model.full_clean()

        model.url = "https://example.com"
        model.full_clean()

        with pytest.raises(ValidationError):
            model.url = "invalid"
            model.full_clean()

    def test_multichoice(self):

        model = FieldModel()