# Path: pyuploadcare/dj/conf.py

# 
# Path: pyuploadcare/dj/forms.py
# class FileWidget(TextInput):
#     class Media:
# class FileField(Field):
# class ImageField(FileField):
# class FileGroupField(Field):
# class ImageGroupField(FileGroupField):
#     def __init__(self, attrs=None):
#     def render(self, name, value, attrs=None, renderer=None):
#     def __init__(self, *args, **kwargs):
#     def to_python(self, value):
#     def widget_attrs(self, widget):
#     def __init__(self, manual_crop=None, *args, **kwargs):
#     def widget_attrs(self, widget):
#     def __init__(self, *args, **kwargs):
#     def to_python(self, value):
#     def widget_attrs(self, widget):
#     def widget_attrs(self, widget):


import unittest
from django import forms
from django.core.exceptions import ValidationError
from pyuploadcare.dj import conf as dj_conf
from pyuploadcare.dj import forms as uc_forms
        self.assertRegexpMatches(
            str(f.media),
            r"https://ucarecdn\.com/libs/widget/[\d\.x]+/uploadcare\.full.min\.js",
        )
        self.assertIn('role="uploadcare-uploader"', str(f["ff"]))
        self.assertIn('data-public-key="asdf"', str(f["ff"]))
        self.assertIn('type="hidden"', str(f["ff"]))

    def test_form_field_custom_attrs(self):
        class SomeForm(forms.Form):
            cf = forms.CharField()
            ff = uc_forms.FileField(
                widget=uc_forms.FileWidget(attrs={"role": "role"})
            )

        f = SomeForm(label_suffix="")
        self.assertRegexpMatches(
            str(f.media),
            r"https://ucarecdn\.com/libs/widget/[\d\.x]+/uploadcare\.full\.min\.js",
        )
        self.assertIn('role="role"', str(f["ff"]))
        self.assertIn('data-public-key="asdf"', str(f["ff"]))
        self.assertIn('type="hidden"', str(f["ff"]))


class FileFieldURLTest(unittest.TestCase):
    def test_returns_url_if_uuid_is_given(self):
        cdn_url = uc_forms.FileField().clean(
            "cde35b21-c5e1-4ed4-b2fc-d4ef4b0538b0"
        )

# Path: pyuploadcare/dj/conf.py

# 
# Path: pyuploadcare/dj/forms.py
# class FileWidget(TextInput):
#     class Media:
# class FileField(Field):
# class ImageField(FileField):
# class FileGroupField(Field):
# class ImageGroupField(FileGroupField):
#     def __init__(self, attrs=None):
#     def render(self, name, value, attrs=None, renderer=None):
#     def __init__(self, *args, **kwargs):
#     def to_python(self, value):
#     def widget_attrs(self, widget):
#     def __init__(self, manual_crop=None, *args, **kwargs):
#     def widget_attrs(self, widget):
#     def __init__(self, *args, **kwargs):
#     def to_python(self, value):
#     def widget_attrs(self, widget):
#     def widget_attrs(self, widget):


# Path: tests/dj/test_forms.py
import unittest
from django import forms
from django.core.exceptions import ValidationError
from pyuploadcare.dj import conf as dj_conf
from pyuploadcare.dj import forms as uc_forms

        self.assertRegexpMatches(
            str(f.media),
            r"https://ucarecdn\.com/libs/widget/[\d\.x]+/uploadcare\.full.min\.js",
        )
        self.assertIn('role="uploadcare-uploader"', str(f["ff"]))
        self.assertIn('data-public-key="asdf"', str(f["ff"]))
        self.assertIn('type="hidden"', str(f["ff"]))

    def test_form_field_custom_attrs(self):
        class SomeForm(forms.Form):
            cf = forms.CharField()
            ff = uc_forms.FileField(
                widget=uc_forms.FileWidget(attrs={"role": "role"})
            )

        f = SomeForm(label_suffix="")
        self.assertRegexpMatches(
            str(f.media),
            r"https://ucarecdn\.com/libs/widget/[\d\.x]+/uploadcare\.full\.min\.js",
        )
        self.assertIn('role="role"', str(f["ff"]))
        self.assertIn('data-public-key="asdf"', str(f["ff"]))
        self.assertIn('type="hidden"', str(f["ff"]))


class FileFieldURLTest(unittest.TestCase):
    def test_returns_url_if_uuid_is_given(self):
        cdn_url = uc_forms.FileField().clean(
            "cde35b21-c5e1-4ed4-b2fc-d4ef4b0538b0"
        )

        expected_cdn_url = (