instance_id stringclasses 28
values | test_id stringlengths 30 622 | affected bool 2
classes | text stringlengths 301 41.6M | license stringclasses 5
values |
|---|---|---|---|---|
wtforms__wtforms-614 | tests/test_validators.py::test_raise_exceptions[IndexError] | true | @pytest.mark.parametrize("exc", [IndexError, ZeroDivisionError, ValueError])
def test_raise_exceptions(exc):
def validate(form, field):
raise exc
class F(Form):
field = StringField(validators=[validate])
f = F()
with pytest.raises(exc):
f.validate()
# --- pre-patch trace ---
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_raise_exceptions[ValueError] | true | @pytest.mark.parametrize("exc", [IndexError, ZeroDivisionError, ValueError])
def test_raise_exceptions(exc):
def validate(form, field):
raise exc
class F(Form):
field = StringField(validators=[validate])
f = F()
with pytest.raises(exc):
f.validate()
# --- pre-patch trace ---
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_raise_exceptions[ZeroDivisionError] | true | @pytest.mark.parametrize("exc", [IndexError, ZeroDivisionError, ValueError])
def test_raise_exceptions(exc):
def validate(form, field):
raise exc
class F(Form):
field = StringField(validators=[validate])
f = F()
with pytest.raises(exc):
f.validate()
# --- pre-patch trace ---
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_regex_passes[^a-None-ABcd-A] | true | @pytest.mark.parametrize(
"re_pattern, re_flags, test_v, expected_v",
[
("^a", None, "abcd", "a"),
("^a", re.I, "ABcd", "A"),
(re.compile("^a"), None, "abcd", "a"),
(re.compile("^a", re.I), None, "ABcd", "A"),
],
)
def test_regex_passes(
re_pattern, re_flags, test_v, expe... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_regex_passes[^a-None-abcd-a0] | true | @pytest.mark.parametrize(
"re_pattern, re_flags, test_v, expected_v",
[
("^a", None, "abcd", "a"),
("^a", re.I, "ABcd", "A"),
(re.compile("^a"), None, "abcd", "a"),
(re.compile("^a", re.I), None, "ABcd", "A"),
],
)
def test_regex_passes(
re_pattern, re_flags, test_v, expe... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_regex_passes[^a-None-abcd-a1] | true | @pytest.mark.parametrize(
"re_pattern, re_flags, test_v, expected_v",
[
("^a", None, "abcd", "a"),
("^a", re.I, "ABcd", "A"),
(re.compile("^a"), None, "abcd", "a"),
(re.compile("^a", re.I), None, "ABcd", "A"),
],
)
def test_regex_passes(
re_pattern, re_flags, test_v, expe... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_regex_passes[^a-re.IGNORECASE-ABcd-A] | true | @pytest.mark.parametrize(
"re_pattern, re_flags, test_v, expected_v",
[
("^a", None, "abcd", "a"),
("^a", re.I, "ABcd", "A"),
(re.compile("^a"), None, "abcd", "a"),
(re.compile("^a", re.I), None, "ABcd", "A"),
],
)
def test_regex_passes(
re_pattern, re_flags, test_v, expe... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_regex_raises[^a-None-ABC] | true | @pytest.mark.parametrize(
"re_pattern, re_flags, test_v",
[
("^a", None, "ABC"),
("^a", re.I, "foo"),
("^a", None, None),
(re.compile("^a"), None, "foo"),
(re.compile("^a", re.I), None, None),
],
)
def test_regex_raises(re_pattern, re_flags, test_v, dummy_form, dummy_... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_regex_raises[^a-None-None0] | true | @pytest.mark.parametrize(
"re_pattern, re_flags, test_v",
[
("^a", None, "ABC"),
("^a", re.I, "foo"),
("^a", None, None),
(re.compile("^a"), None, "foo"),
(re.compile("^a", re.I), None, None),
],
)
def test_regex_raises(re_pattern, re_flags, test_v, dummy_form, dummy_... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_regex_raises[^a-None-None1] | true | @pytest.mark.parametrize(
"re_pattern, re_flags, test_v",
[
("^a", None, "ABC"),
("^a", re.I, "foo"),
("^a", None, None),
(re.compile("^a"), None, "foo"),
(re.compile("^a", re.I), None, None),
],
)
def test_regex_raises(re_pattern, re_flags, test_v, dummy_form, dummy_... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_regex_raises[^a-None-foo] | true | @pytest.mark.parametrize(
"re_pattern, re_flags, test_v",
[
("^a", None, "ABC"),
("^a", re.I, "foo"),
("^a", None, None),
(re.compile("^a"), None, "foo"),
(re.compile("^a", re.I), None, None),
],
)
def test_regex_raises(re_pattern, re_flags, test_v, dummy_form, dummy_... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_regex_raises[^a-re.IGNORECASE-foo] | true | @pytest.mark.parametrize(
"re_pattern, re_flags, test_v",
[
("^a", None, "ABC"),
("^a", re.I, "foo"),
("^a", None, None),
(re.compile("^a"), None, "foo"),
(re.compile("^a", re.I), None, None),
],
)
def test_regex_raises(re_pattern, re_flags, test_v, dummy_form, dummy_... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_regexp_message | true | def test_regexp_message(dummy_form, dummy_field, grab_error_message):
"""
Regexp validator should return given message
"""
validator = regexp("^a", message="foo")
dummy_field.data = "f"
assert grab_error_message(validator, dummy_form, dummy_field) == "foo"
# --- pre-patch trace ---
# === tests/... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_required_passes | true | def test_required_passes(dummy_form, dummy_field):
"""
It should pass when required value is present
"""
validator = data_required()
dummy_field.data = "foobar"
validator(dummy_form, dummy_field)
# --- pre-patch trace ---
# === tests/test_validators.py::test_required_passes (line 333) ===
def t... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_required_stops_validation | true | def test_required_stops_validation(dummy_form, dummy_field):
"""
It should raise stop the validation chain if required value is not present
"""
validator = data_required()
dummy_field.data = ""
with pytest.raises(StopValidation):
validator(dummy_form, dummy_field)
# --- pre-patch trace ... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_email_passes[123@bar.dk] | true | @pytest.mark.parametrize(
"email_address",
["foo@bar.dk", "123@bar.dk", "foo@456.dk", "foo@bar456.info", "foo@bücher.中国"],
)
def test_valid_email_passes(email_address, dummy_form, dummy_field):
"""
Valid email address should pass without raising
"""
validator = email()
dummy_field.data = ema... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_email_passes[foo@456.dk] | true | @pytest.mark.parametrize(
"email_address",
["foo@bar.dk", "123@bar.dk", "foo@456.dk", "foo@bar456.info", "foo@bücher.中国"],
)
def test_valid_email_passes(email_address, dummy_form, dummy_field):
"""
Valid email address should pass without raising
"""
validator = email()
dummy_field.data = ema... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_email_passes[foo@b\xfccher.\u4e2d\u56fd] | true | @pytest.mark.parametrize(
"email_address",
["foo@bar.dk", "123@bar.dk", "foo@456.dk", "foo@bar456.info", "foo@bücher.中国"],
)
def test_valid_email_passes(email_address, dummy_form, dummy_field):
"""
Valid email address should pass without raising
"""
validator = email()
dummy_field.data = ema... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_email_passes[foo@bar.dk] | true | @pytest.mark.parametrize(
"email_address",
["foo@bar.dk", "123@bar.dk", "foo@456.dk", "foo@bar456.info", "foo@bücher.中国"],
)
def test_valid_email_passes(email_address, dummy_form, dummy_field):
"""
Valid email address should pass without raising
"""
validator = email()
dummy_field.data = ema... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_email_passes[foo@bar456.info] | true | @pytest.mark.parametrize(
"email_address",
["foo@bar.dk", "123@bar.dk", "foo@456.dk", "foo@bar456.info", "foo@bücher.中国"],
)
def test_valid_email_passes(email_address, dummy_form, dummy_field):
"""
Valid email address should pass without raising
"""
validator = email()
dummy_field.data = ema... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_mac_passes[01:23:45:67:ab:CD] | true | @pytest.mark.parametrize("mac_addr_val", ["01:23:45:67:ab:CD"])
def test_valid_mac_passes(mac_addr_val, dummy_form, dummy_field):
"""
Valid MAC address should pass without raising
"""
validator = mac_address()
dummy_field.data = mac_addr_val
validator(dummy_form, dummy_field)
# --- pre-patch tr... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_notld_passes[http://foobar/path?query=param&foo=faa] | true | @pytest.mark.parametrize(
"url_val",
[
"http://localhost/foobar",
"http://foobar",
"http://foobar?query=param&foo=faa",
"http://foobar:5000?query=param&foo=faa",
"http://foobar/path?query=param&foo=faa",
"http://foobar:1234/path?query=param&foo=faa",
],
)
def ... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_notld_passes[http://foobar:1234/path?query=param&foo=faa] | true | @pytest.mark.parametrize(
"url_val",
[
"http://localhost/foobar",
"http://foobar",
"http://foobar?query=param&foo=faa",
"http://foobar:5000?query=param&foo=faa",
"http://foobar/path?query=param&foo=faa",
"http://foobar:1234/path?query=param&foo=faa",
],
)
def ... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_notld_passes[http://foobar:5000?query=param&foo=faa] | true | @pytest.mark.parametrize(
"url_val",
[
"http://localhost/foobar",
"http://foobar",
"http://foobar?query=param&foo=faa",
"http://foobar:5000?query=param&foo=faa",
"http://foobar/path?query=param&foo=faa",
"http://foobar:1234/path?query=param&foo=faa",
],
)
def ... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_notld_passes[http://foobar?query=param&foo=faa] | true | @pytest.mark.parametrize(
"url_val",
[
"http://localhost/foobar",
"http://foobar",
"http://foobar?query=param&foo=faa",
"http://foobar:5000?query=param&foo=faa",
"http://foobar/path?query=param&foo=faa",
"http://foobar:1234/path?query=param&foo=faa",
],
)
def ... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_notld_passes[http://foobar] | true | @pytest.mark.parametrize(
"url_val",
[
"http://localhost/foobar",
"http://foobar",
"http://foobar?query=param&foo=faa",
"http://foobar:5000?query=param&foo=faa",
"http://foobar/path?query=param&foo=faa",
"http://foobar:1234/path?query=param&foo=faa",
],
)
def ... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_notld_passes[http://localhost/foobar] | true | @pytest.mark.parametrize(
"url_val",
[
"http://localhost/foobar",
"http://foobar",
"http://foobar?query=param&foo=faa",
"http://foobar:5000?query=param&foo=faa",
"http://foobar/path?query=param&foo=faa",
"http://foobar:1234/path?query=param&foo=faa",
],
)
def ... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://192.168.0.1/foobar] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://192.168.0.1:9000/fake] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://\u0645\u062b\u0627\u0644.\u0625\u062e\u062a\u0628\u0627\u0631/foo.com] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://\u0909\u0926\u093e\u0939\u0930\u0923.\u092a\u0930\u0940\u0915\u094d\u0937\u093e/] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://\uc2e4\ub840.\ud14c\uc2a4\ud2b8] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://foo--bar.dk/] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://foo-bar.dk/] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://foo_bar.dk/] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://foobar.dk/] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://foobar.dk/path?query=param&foo=faa] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://foobar.dk/path?query=param] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://foobar.dk?query=param] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://foobar.dk] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_url_passes[http://foobar.museum/foobar] | true | @pytest.mark.parametrize(
"url_val",
[
"http://foobar.dk",
"http://foobar.dk/",
"http://foo-bar.dk/",
"http://foo--bar.dk/",
"http://foo_bar.dk/",
"http://foobar.dk?query=param",
"http://foobar.dk/path?query=param",
"http://foobar.dk/path?query=par... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_uuid_passes[2bc1c94f-0deb-43e9-92a1-4775189ec9f8] | true | @pytest.mark.parametrize(
"uuid_val",
["2bc1c94f-0deb-43e9-92a1-4775189ec9f8", "2bc1c94f0deb43e992a14775189ec9f8"],
)
def test_valid_uuid_passes(uuid_val, dummy_form, dummy_field):
"""
Valid UUID should pass without raising
"""
validator = UUID()
dummy_field.data = uuid_val
validator(dum... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_validators.py::test_valid_uuid_passes[2bc1c94f0deb43e992a14775189ec9f8] | true | @pytest.mark.parametrize(
"uuid_val",
["2bc1c94f-0deb-43e9-92a1-4775189ec9f8", "2bc1c94f0deb43e992a14775189ec9f8"],
)
def test_valid_uuid_passes(uuid_val, dummy_form, dummy_field):
"""
Valid UUID should pass without raising
"""
validator = UUID()
dummy_field.data = uuid_val
validator(dum... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestBasicWidgets::test_checkbox_input | true | def test_checkbox_input(self, basic_widget_dummy_field):
assert (
CheckboxInput()(basic_widget_dummy_field, value="v")
== '<input checked id="id" name="bar" type="checkbox" value="v">'
)
# set falsy value to dummy field
basic_widget_dummy_field.data = ""
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestBasicWidgets::test_file | true | def test_file(self, basic_widget_dummy_field):
assert (
FileInput()(basic_widget_dummy_field)
== '<input id="id" name="bar" type="file">'
)
assert (
FileInput(multiple=True)(basic_widget_dummy_field)
== '<input id="id" multiple name="bar" type=... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestBasicWidgets::test_hidden_input | true | def test_hidden_input(self, basic_widget_dummy_field):
assert 'type="hidden"' in HiddenInput()(basic_widget_dummy_field)
assert "hidden" in HiddenInput().field_flags
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES.rst b/CHANGES.rst
index 50f43a2..a199f46 100644
--- a/CHANGES.rst
++... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestBasicWidgets::test_html_marking | true | def test_html_marking(self, basic_widget_dummy_field):
html = TextInput()(basic_widget_dummy_field)
assert hasattr(html, "__html__")
assert html.__html__() is html
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES.rst b/CHANGES.rst
index 50f43a2..a199f46 100644
--- a/CHANGES.... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestBasicWidgets::test_input_type | true | def test_input_type(self):
with pytest.raises(AttributeError):
Input().input_type
test_input = Input(input_type="test")
assert test_input.input_type == "test"
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES.rst b/CHANGES.rst
index 50f43a2..a199f46 100644
--- a/... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestBasicWidgets::test_password_input | true | def test_password_input(self, basic_widget_dummy_field):
assert 'type="password"' in PasswordInput()(basic_widget_dummy_field)
assert 'value=""' in PasswordInput()(basic_widget_dummy_field)
assert 'value="foo"' in PasswordInput(hide_value=False)(
basic_widget_dummy_field
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestBasicWidgets::test_radio_input | true | def test_radio_input(self, basic_widget_dummy_field):
basic_widget_dummy_field.checked = True
expected = '<input checked id="id" name="bar" type="radio" value="foo">'
assert RadioInput()(basic_widget_dummy_field) == expected
basic_widget_dummy_field.checked = False
assert Rad... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestBasicWidgets::test_text_input | true | def test_text_input(self, basic_widget_dummy_field):
assert (
TextInput()(basic_widget_dummy_field)
== '<input id="id" name="bar" type="text" value="foo">'
)
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES.rst b/CHANGES.rst
index 50f43a2..a199f46 100644
--- ... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestBasicWidgets::test_textarea | true | def test_textarea(self, basic_widget_dummy_field):
# Make sure textareas escape properly and render properly
basic_widget_dummy_field.data = "hi<>bye"
basic_widget_dummy_field.name = "f"
basic_widget_dummy_field.id = ""
assert (
TextArea()(basic_widget_dummy_field... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestHTML5::test_number | true | def test_number(self, html5_dummy_field):
i1 = NumberInput(step="any")
assert (
i1(html5_dummy_field)
== '<input id="id" name="bar" step="any" type="number" value="42">'
)
i2 = NumberInput(step=2)
assert (
i2(html5_dummy_field, step=3)
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestHTML5::test_range | true | def test_range(self, html5_dummy_field):
i1 = RangeInput(step="any")
assert (
i1(html5_dummy_field)
== '<input id="id" name="bar" step="any" type="range" value="42">'
)
i2 = RangeInput(step=2)
assert (
i2(html5_dummy_field, step=3)
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestHTMLParams::test_aria_prefix | true | def test_aria_prefix(self):
assert html_params(aria_foo="bar") == 'aria-foo="bar"'
assert html_params(aria_foo_bar="foobar") == 'aria-foo-bar="foobar"'
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES.rst b/CHANGES.rst
index 50f43a2..a199f46 100644
--- a/CHANGES.rst
+++ b/CHANGES.rs... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestHTMLParams::test_basic | true | def test_basic(self):
assert html_params(foo=9, k="wuuu") == 'foo="9" k="wuuu"'
assert html_params(class_="foo") == 'class="foo"'
assert html_params(class__="foo") == 'class="foo"'
assert html_params(for_="foo") == 'for="foo"'
assert html_params(readonly=False, foo=9) == 'foo... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestHTMLParams::test_data_prefix | true | def test_data_prefix(self):
assert html_params(data_foo=22) == 'data-foo="22"'
assert html_params(data_foo_bar=1) == 'data-foo-bar="1"'
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES.rst b/CHANGES.rst
index 50f43a2..a199f46 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -34,7 +34,7... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestHTMLParams::test_quoting | true | def test_quoting(self):
assert html_params(foo='hi&bye"quot') == 'foo="hi&bye"quot"'
# --- pre-patch trace ---
# --- patch ---
diff --git a/CHANGES.rst b/CHANGES.rst
index 50f43a2..a199f46 100644
--- a/CHANGES.rst
+++ b/CHANGES.rst
@@ -34,7 +34,7 @@ Unreleased
- Render attribute names like ``f... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestListWidget::test_listwidget | true | def test_listwidget(self, dummy_field_class):
# ListWidget just expects an iterable of field-like objects as its
# 'field' so that is what we will give it
field = dummy_field_class(
[dummy_field_class(x, label="l" + x) for x in ["foo", "bar"]], id="hai"
)
assert ... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestSelect::test_render_option | true | def test_render_option(self):
# value, label, selected
assert (
Select.render_option("bar", "foo", False)
== '<option value="bar">foo</option>'
)
assert (
Select.render_option(True, "foo", True)
== '<option selected value="True">foo</o... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestSelect::test_select | true | def test_select(self, select_dummy_field):
select_dummy_field.name = "f"
assert (
Select()(select_dummy_field)
== '<select id="" name="f"><option selected value="foo">lfoo</option>'
'<option value="bar">lbar</option></select>'
)
assert (
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_widgets.py::TestTableWidget::test_tablewidget | true | def test_tablewidget(self, dummy_field_class):
inner_fields = [
dummy_field_class(data="hidden1", field_type="HiddenField"),
dummy_field_class(data="foo", label="lfoo"),
dummy_field_class(data="bar", label="lbar"),
dummy_field_class(data="hidden2", field_type=... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_csrf.py::TestDummyCSRF::test_base_class | false | def test_base_class(self):
with pytest.raises(NotImplementedError):
self.F(meta={"csrf_class": CSRF})
# --- trace ---
# === tests/test_csrf.py::TestDummyCSRF.test_base_class (line 54) ===
def test_base_class(self):
# ENTER: self=TestDummyCSRF({})
with pytest.raises(NotImplem... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_csrf.py::TestDummyCSRF::test_basic_impl | false | def test_basic_impl(self):
form = self.F()
assert "csrf_token" in form
assert not form.validate()
assert form.csrf_token._value() == "dummytoken"
form = self.F(DummyPostData(csrf_token="dummytoken"))
assert form.validate()
# --- trace ---
# === tests/test_csrf.py::Te... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_csrf.py::TestDummyCSRF::test_csrf_off | false | def test_csrf_off(self):
form = self.F(meta={"csrf": False})
assert "csrf_token" not in form
# --- trace ---
# === tests/test_csrf.py::TestDummyCSRF.test_csrf_off (line 66) ===
def test_csrf_off(self):
# ENTER: self=TestDummyCSRF({})
form = self.F(meta={"csrf": False})
# === sr... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_csrf.py::TestDummyCSRF::test_no_populate | false | def test_no_populate(self):
obj = SimplePopulateObject()
form = self.F(a="test", csrf_token="dummytoken")
form.populate_obj(obj)
assert obj.csrf_token is None
assert obj.a == "test"
# --- trace ---
# === tests/test_csrf.py::TestDummyCSRF.test_no_populate (line 75) ===
de... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_csrf.py::TestDummyCSRF::test_rename | false | def test_rename(self):
form = self.F(meta={"csrf_field_name": "mycsrf"})
assert "mycsrf" in form
assert "csrf_token" not in form
# --- trace ---
# === tests/test_csrf.py::TestDummyCSRF.test_rename (line 70) ===
def test_rename(self):
# ENTER: self=TestDummyCSRF({})
form ... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_csrf.py::TestSessionCSRF::test_detailed_expected_values | false | def test_detailed_expected_values(self):
"""
A full test with the date and time pinned so we get deterministic output.
"""
session = {"csrf": "93fed52fa69a2b2b0bf9c350c8aeeb408b6b6dfa"}
dt = partial(datetime.datetime, 2013, 1, 15)
with TimePin.pin_time(dt(8, 11, 12)):... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_csrf.py::TestSessionCSRF::test_no_time_limit | false | def test_no_time_limit(self):
session = {}
form = self._test_phase1(self.NoTimeLimit, session)
expected_csrf = hmac.new(
b"foobar", session["csrf"].encode("ascii"), digestmod=hashlib.sha1
).hexdigest()
assert form.csrf_token.current_token == "##" + expected_csrf
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_csrf.py::TestSessionCSRF::test_various_failures | false | def test_various_failures(self):
with pytest.raises(TypeError):
self.F()
with pytest.raises(Exception):
self.F(meta={"csrf_secret": None})
# --- trace ---
# === tests/test_csrf.py::TestSessionCSRF.test_various_failures (line 99) ===
def test_various_failures(self):
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_csrf.py::TestSessionCSRF::test_with_time_limit | false | def test_with_time_limit(self):
session = {}
form = self._test_phase1(self.F, session)
self._test_phase2(self.F, session, form.csrf_token.current_token)
# --- trace ---
# === tests/test_csrf.py::TestSessionCSRF.test_with_time_limit (line 114) ===
def test_with_time_limit(self):
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestBaseForm::test_contains | false | def test_contains(self):
form = self.get_form()
assert "test" in form
assert "abcd" not in form
# --- trace ---
# === tests/test_form.py::TestBaseForm.test_contains (line 37) ===
def test_contains(self):
# ENTER: self=TestBaseForm({})
form = self.get_form()
# === tests/... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestBaseForm::test_data_proxy | false | def test_data_proxy(self):
form = self.get_form()
form.process(test="foo")
assert form.data == {"test": "foo"}
# --- trace ---
# === tests/test_form.py::TestBaseForm.test_data_proxy (line 21) ===
def test_data_proxy(self):
# ENTER: self=TestBaseForm({})
form = self.get_f... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestBaseForm::test_errors_proxy | false | def test_errors_proxy(self):
form = self.get_form()
form.process(test="foobar")
form.validate()
assert form.errors == {}
form = self.get_form()
form.process()
form.validate()
assert form.errors == {"test": ["error"]}
# --- trace ---
# === tests/test_... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestBaseForm::test_field_adding | false | def test_field_adding(self):
form = self.get_form()
assert len(list(form)) == 1
form["foo"] = StringField()
assert len(list(form)) == 2
form.process(DummyPostData(foo=["hello"]))
assert form["foo"].data == "hello"
form["test"] = IntegerField()
assert i... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestBaseForm::test_field_removal | false | def test_field_removal(self):
form = self.get_form()
del form["test"]
with pytest.raises(AttributeError):
form.test
assert "test" not in form
# --- trace ---
# === tests/test_form.py::TestBaseForm.test_field_removal (line 42) ===
def test_field_removal(self):
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestBaseForm::test_formdata_wrapper_error | false | def test_formdata_wrapper_error(self):
form = self.get_form()
with pytest.raises(TypeError):
form.process([])
# --- trace ---
# === tests/test_form.py::TestBaseForm.test_formdata_wrapper_error (line 83) ===
def test_formdata_wrapper_error(self):
# ENTER: self=TestBaseForm({}... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestBaseForm::test_populate_obj | false | def test_populate_obj(self):
m = type("Model", (object,), {})
form = self.get_form()
form.process(test="foobar")
form.populate_obj(m)
assert m.test == "foobar"
assert [k for k in dir(m) if not k.startswith("_")] == ["test"]
# --- trace ---
# === tests/test_form.py::T... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestBaseForm::test_prefixes | false | def test_prefixes(self):
form = self.get_form(prefix="foo")
assert form["test"].name == "foo-test"
assert form["test"].short_name == "test"
assert form["test"].id == "foo-test"
form = self.get_form(prefix="foo.")
form.process(DummyPostData({"foo.test": ["hello"], "tes... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestForm::test_data_arg | false | def test_data_arg(self):
data = {"test": "foo"}
form = self.F(data=data)
assert form.test.data == "foo"
form = self.F(data=data, test="bar")
assert form.test.data == "bar"
# --- trace ---
# === tests/test_form.py::TestForm.test_data_arg (line 250) ===
def test_data_arg(s... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestForm::test_delattr_idempotency | false | def test_delattr_idempotency(self):
form = self.F()
del form.test
assert form.test is None
# Make sure deleting a normal attribute works
form.foo = 9
del form.foo
with pytest.raises(AttributeError):
form.__delattr__("foo")
# Check idempot... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestForm::test_empty_formdata | false | def test_empty_formdata(self):
""""If formdata is empty, field.process_formdata should still
run to handle empty data.
"""
class EmptyStringField(StringField):
def process_formdata(self, valuelist):
self.data = valuelist[0] if valuelist else "processed"
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestForm::test_errors_access_during_validation | false | def test_errors_access_during_validation(self):
class F(Form):
foo = StringField(validators=[DataRequired()])
def validate(self):
super().validate()
self.errors
self.foo.errors.append("bar")
return True
form = ... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestForm::test_field_adding_disabled | false | def test_field_adding_disabled(self):
form = self.F()
with pytest.raises(TypeError):
form.__setitem__("foo", StringField())
# --- trace ---
# === tests/test_form.py::TestForm.test_field_adding_disabled (line 202) ===
def test_field_adding_disabled(self):
# ENTER: self=TestFo... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestForm::test_field_removal | false | def test_field_removal(self):
form = self.F()
del form.test
assert "test" not in form
assert form.test is None
assert len(list(form)) == 0
# Try deleting a nonexistent field
with pytest.raises(AttributeError):
form.__delattr__("fake")
# --- trace ... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestForm::test_form_level_errors | false | def test_form_level_errors(self):
class F(Form):
a = IntegerField()
b = IntegerField()
def validate(self):
if not super().validate():
return False
if (self.a.data + self.b.data) % 2 != 0:
self.form_... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestForm::test_ordered_fields | false | def test_ordered_fields(self):
class MyForm(Form):
strawberry = StringField()
banana = StringField()
kiwi = StringField()
assert [x.name for x in MyForm()] == ["strawberry", "banana", "kiwi"]
MyForm.apple = StringField()
assert [x.name for x in My... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestForm::test_validate | false | def test_validate(self):
form = self.F(test="foobar")
assert form.validate() is True
form = self.F()
assert form.validate() is False
# --- trace ---
# === tests/test_form.py::TestForm.test_validate (line 153) ===
def test_validate(self):
# ENTER: self=TestForm({})
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestForm::test_validate_with_extra | false | def test_validate_with_extra(self):
class F2(self.F):
other = StringField()
def extra(form, field):
if field.data != "extra":
raise ValidationError("error")
form = F2(test="foobar", other="extra")
assert form.validate(extra_validators={"other... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestFormMeta::test_class_meta_reassign | false | def test_class_meta_reassign(self):
class MetaA:
pass
class MetaB:
pass
class F(Form):
Meta = MetaA
assert F._wtforms_meta is None
assert isinstance(F().meta, MetaA)
assert issubclass(F._wtforms_meta, MetaA)
F.Meta = Meta... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestFormMeta::test_monkeypatch | false | def test_monkeypatch(self):
class F(Form):
a = StringField()
assert F._unbound_fields is None
F()
assert F._unbound_fields == [("a", F.a)]
F.b = StringField()
assert F._unbound_fields is None
F()
assert F._unbound_fields == [("a", F.a), ("... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestFormMeta::test_subclassing | false | def test_subclassing(self):
class A(Form):
a = StringField()
c = StringField()
class B(A):
b = StringField()
c = StringField()
A()
B()
assert A.a is B.a
assert A.c is not B.c
assert A._unbound_fields == [("a",... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestMeta::test_basic | false | def test_basic(self):
form = self.Basic()
meta = form.meta
assert meta.foo == 9
assert meta.bar == 8
assert meta.csrf is False
assert isinstance(meta, self.F.Meta)
assert isinstance(meta, self.G.Meta)
assert type(meta).__bases__ == (
self.B... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_form.py::TestMeta::test_missing_diamond | false | def test_missing_diamond(self):
meta = self.MissingDiamond().meta
assert type(meta).__bases__ == (self.F.Meta, self.G.Meta, DefaultMeta)
# --- trace ---
# === tests/test_form.py::TestMeta.test_missing_diamond (line 326) ===
def test_missing_diamond(self):
# ENTER: self=TestMeta({})
... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_i18n.py::TestCoreForm::test_cache | false | def test_cache(self):
settings = {"meta": {"locales": ["de_DE"], "cache_translations": True}}
expected = "Dieses Feld wird ben\xf6tigt."
form1 = self._common_test(expected, settings)
form2 = self._common_test(expected, settings)
assert form1.meta.get_translations(form1) is fo... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_i18n.py::TestCoreForm::test_defaults | false | def test_defaults(self):
# Test with the default language
form = self._common_test("This field is required.", {})
# Make sure we have a gettext translations context
assert form.a.gettext("") != ""
form = self._common_test("This field is required.", {}, self.F2)
asser... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_i18n.py::TestCoreForm::test_fallback | false | def test_fallback(self):
form = self._common_test(
"This field is required.", dict(meta=dict(locales=False))
)
assert form.a.gettext("") == ""
# --- trace ---
# === tests/test_i18n.py::TestCoreForm.test_fallback (line 95) ===
def test_fallback(self):
# ENTER: self=Te... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_i18n.py::TestCoreForm::test_ngettext | false | def test_ngettext(self):
language_settings = [
(
["en_US", "en"],
"Field cannot be longer than 3 characters.",
"Field cannot be longer than 1 character.",
),
(
["de_DE", "de"],
"Feld kann nich... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_i18n.py::TestCoreForm::test_override_languages | false | def test_override_languages(self):
self._common_test(
"Este campo es obligatorio.", dict(meta=dict(locales=["es_ES"]))
)
# --- trace ---
# === tests/test_i18n.py::TestCoreForm.test_override_languages (line 101) ===
def test_override_languages(self):
# ENTER: self=TestCoreFor... | BSD-3-Clause |
wtforms__wtforms-614 | tests/test_i18n.py::TestI18N::test_failure | false | def test_failure(self):
with pytest.raises(IOError):
get_translations([])
# --- trace ---
# === tests/test_i18n.py::TestI18N.test_failure (line 35) ===
def test_failure(self):
# ENTER: self=TestI18N({})
with pytest.raises(IOError):
get_translations([])
# === src... | BSD-3-Clause |