repo string | instance_id string | base_commit string | patch string | test_patch string | problem_statement string | hints_text string | created_at string | version string | FAIL_TO_PASS string | PASS_TO_PASS string | environment_setup_commit string | difficulty string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
astropy/astropy | astropy__astropy-13398 | 6500928dc0e57be8f06d1162eacc3ba5e2eff692 | diff --git a/astropy/coordinates/builtin_frames/__init__.py b/astropy/coordinates/builtin_frames/__init__.py
--- a/astropy/coordinates/builtin_frames/__init__.py
+++ b/astropy/coordinates/builtin_frames/__init__.py
@@ -48,6 +48,7 @@
from . import icrs_cirs_transforms
from . import cirs_observed_transforms
from . imp... | diff --git a/astropy/coordinates/tests/test_intermediate_transformations.py b/astropy/coordinates/tests/test_intermediate_transformations.py
--- a/astropy/coordinates/tests/test_intermediate_transformations.py
+++ b/astropy/coordinates/tests/test_intermediate_transformations.py
@@ -194,6 +194,116 @@ def test_cirs_to_ha... | A direct approach to ITRS to Observed transformations that stays within the ITRS.
<!-- This comments are hidden when you submit the issue,
so you do not need to remove them! -->
<!-- Please be sure to check out our contributing guidelines,
https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md .
Please be s... | cc @StuartLittlefair, @adrn, @eteq, @eerovaher, @mhvk
Yes, would be good to address this recurring problem. But we somehow have to ensure it gets used only when relevant. For instance, the coordinates better have a distance, and I suspect it has to be near Earth...
Yeah, so far I've made no attempt at hardening this a... | 2022-06-24T15:22:11Z | 5.0 | ["astropy/coordinates/tests/test_intermediate_transformations.py::test_itrs_topo_to_altaz_with_refraction", "astropy/coordinates/tests/test_intermediate_transformations.py::test_itrs_topo_to_hadec_with_refraction", "astropy/coordinates/tests/test_intermediate_transformations.py::test_cirs_itrs_topo", "astropy/coordinat... | ["astropy/coordinates/tests/test_intermediate_transformations.py::test_icrs_gcrs[icoo0]", "astropy/coordinates/tests/test_intermediate_transformations.py::test_icrs_gcrs[icoo1]", "astropy/coordinates/tests/test_intermediate_transformations.py::test_icrs_gcrs_dist_diff[gframe0]", "astropy/coordinates/tests/test_intermed... | cdf311e0714e611d48b0a31eb1f0e2cbffab7f23 | 1-4 hours |
astropy/astropy | astropy__astropy-14508 | a3f4ae6cd24d5ecdf49f213d77b3513dd509a06c | diff --git a/astropy/io/fits/card.py b/astropy/io/fits/card.py
--- a/astropy/io/fits/card.py
+++ b/astropy/io/fits/card.py
@@ -1298,31 +1298,17 @@ def _format_value(value):
def _format_float(value):
- """Format a floating number to make sure it gets the decimal point."""
- value_str = f"{value:.16G}"
- if... | diff --git a/astropy/io/fits/tests/test_header.py b/astropy/io/fits/tests/test_header.py
--- a/astropy/io/fits/tests/test_header.py
+++ b/astropy/io/fits/tests/test_header.py
@@ -137,6 +137,27 @@ def test_floating_point_value_card(self):
):
assert str(c) == _pad("FLOATNUM= -4.6737463674763E+32")
... | `io.fits.Card` may use a string representation of floats that is larger than necessary
### Description
In some scenarios, `io.fits.Card` may use a string representation of floats that is larger than necessary, which can force comments to be truncated. Due to this, there are some keyword/value/comment combinations that... | Agreed this is a bug. As far as I know, python floats by default now have reprs that use the right number of digits to be reproducible. So I think replacing this by `value_str = str(value)` should be totally fine. Do you want to try that and run the tests, to see if it works? If so, I think we should make that change ... | 2023-03-09T11:08:51Z | 5.1 | ["astropy/io/fits/tests/test_header.py::TestHeaderFunctions::test_floating_point_string_representation_card"] | ["astropy/io/fits/tests/test_header.py::test_shallow_copy", "astropy/io/fits/tests/test_header.py::test_init_with_header", "astropy/io/fits/tests/test_header.py::test_init_with_dict", "astropy/io/fits/tests/test_header.py::test_init_with_ordereddict", "astropy/io/fits/tests/test_header.py::TestHeaderFunctions::test_ren... | 5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5 | 15 min - 1 hour |
astropy/astropy | astropy__astropy-14539 | c0a24c1dc957a3b565294213f435fefb2ec99714 | diff --git a/astropy/io/fits/diff.py b/astropy/io/fits/diff.py
--- a/astropy/io/fits/diff.py
+++ b/astropy/io/fits/diff.py
@@ -1449,7 +1449,7 @@ def _diff(self):
arrb.dtype, np.floating
):
diffs = where_not_allclose(arra, arrb, rtol=self.rtol, atol=self.atol)
- ... | diff --git a/astropy/io/fits/tests/test_diff.py b/astropy/io/fits/tests/test_diff.py
--- a/astropy/io/fits/tests/test_diff.py
+++ b/astropy/io/fits/tests/test_diff.py
@@ -406,16 +406,17 @@ def test_identical_tables(self):
c8 = Column("H", format="C", array=[0.0 + 1.0j, 2.0 + 3.0j])
c9 = Column("I", fo... | `io.fits.FITSDiff` may sometimes report differences between identical files
### Description
In some scenarios, `io.fits.FITSDiff` may report differences between identical files, even when comparing the same file to itself. This may be caused by improper handling of VLAs (variable-length arrays).
### Expected behavior... | Seems due to the use of `Q`, only `P` is handled in the diff code. This:
```
--- astropy/io/fits/diff.py
+++ astropy/io/fits/diff.py
@@ -1449,7 +1449,7 @@ class TableDataDiff(_BaseDiff):
arrb.dtype, np.floating
):
diffs = where_not_allclose(arra, arrb, rtol=self.rto... | 2023-03-16T18:45:19Z | 5.1 | ["astropy/io/fits/tests/test_diff.py::TestDiff::test_identical_tables", "astropy/io/fits/tests/test_diff.py::TestDiff::test_different_table_data"] | ["astropy/io/fits/tests/test_diff.py::TestDiff::test_identical_headers", "astropy/io/fits/tests/test_diff.py::TestDiff::test_slightly_different_headers", "astropy/io/fits/tests/test_diff.py::TestDiff::test_common_keywords", "astropy/io/fits/tests/test_diff.py::TestDiff::test_different_keyword_count", "astropy/io/fits/t... | 5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5 | 15 min - 1 hour |
astropy/astropy | astropy__astropy-14995 | b16c7d12ccbc7b2d20364b89fb44285bcbfede54 | diff --git a/astropy/nddata/mixins/ndarithmetic.py b/astropy/nddata/mixins/ndarithmetic.py
--- a/astropy/nddata/mixins/ndarithmetic.py
+++ b/astropy/nddata/mixins/ndarithmetic.py
@@ -520,10 +520,10 @@ def _arithmetic_mask(self, operation, operand, handle_mask, axis=None, **kwds):
elif self.mask is None and ope... | diff --git a/astropy/nddata/mixins/tests/test_ndarithmetic.py b/astropy/nddata/mixins/tests/test_ndarithmetic.py
--- a/astropy/nddata/mixins/tests/test_ndarithmetic.py
+++ b/astropy/nddata/mixins/tests/test_ndarithmetic.py
@@ -1310,3 +1310,42 @@ def test_raise_method_not_supported():
# raise error for unsupported ... | In v5.3, NDDataRef mask propagation fails when one of the operand does not have a mask
### Description
This applies to v5.3.
It looks like when one of the operand does not have a mask, the mask propagation when doing arithmetic, in particular with `handle_mask=np.bitwise_or` fails. This is not a problem in v5.2.
... | Welcome to Astropy 👋 and thank you for your first issue!
A project member will respond to you as soon as possible; in the meantime, please double-check the [guidelines for submitting issues](https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md#reporting-issues) and make sure you've provided the requested deta... | 2023-06-27T19:48:18Z | 5.2 | ["astropy/nddata/mixins/tests/test_ndarithmetic.py::test_nddata_bitmask_arithmetic"] | ["astropy/nddata/mixins/tests/test_ndarithmetic.py::test_arithmetics_data[data10-data20]", "astropy/nddata/mixins/tests/test_ndarithmetic.py::test_arithmetics_data[data11-data21]", "astropy/nddata/mixins/tests/test_ndarithmetic.py::test_arithmetics_data[data12-data22]", "astropy/nddata/mixins/tests/test_ndarithmetic.py... | 362f6df12abf9bd769d4915fabf955c993ea22cf | <15 min fix |
astropy/astropy | astropy__astropy-7166 | 26d147868f8a891a6009a25cd6a8576d2e1bd747 | diff --git a/astropy/utils/misc.py b/astropy/utils/misc.py
--- a/astropy/utils/misc.py
+++ b/astropy/utils/misc.py
@@ -4,9 +4,6 @@
A "grab bag" of relatively small general-purpose utilities that don't have
a clear module/package to live in.
"""
-
-
-
import abc
import contextlib
import difflib
@@ -27,7 +24,6 @@
... | diff --git a/astropy/utils/tests/test_misc.py b/astropy/utils/tests/test_misc.py
--- a/astropy/utils/tests/test_misc.py
+++ b/astropy/utils/tests/test_misc.py
@@ -80,14 +80,26 @@ def __call__(self, *args):
"FOO"
pass
+ @property
+ def bar(self):
+ "BAR"
+ ... | InheritDocstrings metaclass doesn't work for properties
Inside the InheritDocstrings metaclass it uses `inspect.isfunction` which returns `False` for properties.
| This was as implemented back in #2159. I don't see any `inspect.isproperty`. Do you have any suggestions?
I guess it should work with [inspect.isdatadescriptor](https://docs.python.org/3/library/inspect.html#inspect.isdatadescriptor).
And I wonder if this class is still needed, it seems that it started with #2136 for... | 2018-02-07T15:05:31Z | 1.3 | ["astropy/utils/tests/test_misc.py::test_inherit_docstrings"] | ["astropy/utils/tests/test_misc.py::test_isiterable", "astropy/utils/tests/test_misc.py::test_signal_number_to_name_no_failure", "astropy/utils/tests/test_misc.py::test_skip_hidden", "astropy/utils/tests/test_misc.py::test_JsonCustomEncoder", "astropy/utils/tests/test_misc.py::test_check_broadcast", "astropy/utils/test... | 848c8fa21332abd66b44efe3cb48b72377fb32cc | <15 min fix |
django/django | django__django-11292 | eb16c7260e573ec513d84cb586d96bdf508f3173 | diff --git a/django/core/management/base.py b/django/core/management/base.py
--- a/django/core/management/base.py
+++ b/django/core/management/base.py
@@ -95,7 +95,7 @@ class DjangoHelpFormatter(HelpFormatter):
"""
show_last = {
'--version', '--verbosity', '--traceback', '--settings', '--pythonpath',... | diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py
--- a/tests/user_commands/tests.py
+++ b/tests/user_commands/tests.py
@@ -253,6 +253,16 @@ def test_disallowed_abbreviated_options(self):
self.assertNoOutput(err)
self.assertEqual(out.strip(), 'Set foo')
+ def test_skip_chec... | Add --skip-checks option to management commands.
Description
Management commands already have skip_checks stealth option. I propose exposing this option on the command line. This would allow users to skip checks when running a command from the command line. Sometimes in a development environment, it is nice to move a... | 2019-04-27T14:23:07Z | 3.0 | ["test_skip_checks (user_commands.tests.CommandRunTests)"] | ["test_get_random_secret_key (user_commands.tests.UtilsTests)", "test_is_ignored_path_false (user_commands.tests.UtilsTests)", "test_is_ignored_path_true (user_commands.tests.UtilsTests)", "test_no_existent_external_program (user_commands.tests.UtilsTests)", "test_normalize_path_patterns_truncates_wildcard_base (user_c... | 419a78300f7cd27611196e1e464d50fd0385ff27 | 15 min - 1 hour | |
django/django | django__django-11400 | 1f8382d34d54061eddc41df6994e20ee38c60907 | diff --git a/django/contrib/admin/filters.py b/django/contrib/admin/filters.py
--- a/django/contrib/admin/filters.py
+++ b/django/contrib/admin/filters.py
@@ -193,11 +193,17 @@ def has_output(self):
def expected_parameters(self):
return [self.lookup_kwarg, self.lookup_kwarg_isnull]
- def field_choice... | diff --git a/tests/admin_filters/tests.py b/tests/admin_filters/tests.py
--- a/tests/admin_filters/tests.py
+++ b/tests/admin_filters/tests.py
@@ -591,6 +591,22 @@ class BookAdmin(ModelAdmin):
expected = [(self.john.pk, 'John Blue'), (self.jack.pk, 'Jack Red')]
self.assertEqual(filterspec.lookup_choic... | Ordering problem in admin.RelatedFieldListFilter and admin.RelatedOnlyFieldListFilter
Description
RelatedFieldListFilter doesn't fall back to the ordering defined in Model._meta.ordering.
Ordering gets set to an empty tuple in https://github.com/django/django/blob/2.2.1/django/contrib/admin/filters.py#L196 and unle... | Sample project illustrating the problem. Navigate to /admin/foo/book and observer the order of Author in the list filters.
Screenshot of RelatedOnlyFieldListFilter not ordering items.
OK, yes, seems a reasonable suggestion if you'd like to work on it.
Hello. We've updated our django recently and faced this bug. For me ... | 2019-05-22T11:30:39Z | 3.0 | ["test_get_choices_default_ordering (model_fields.tests.GetChoicesOrderingTests)", "test_get_choices_reverse_related_field_default_ordering (model_fields.tests.GetChoicesOrderingTests)", "RelatedFieldListFilter ordering respects Model.ordering.", "test_relatedfieldlistfilter_reverse_relationships_default_ordering (admi... | ["test_choices_and_field_display (model_fields.tests.GetFieldDisplayTests)", "test_empty_iterator_choices (model_fields.tests.GetFieldDisplayTests)", "A translated display value is coerced to str.", "test_iterator_choices (model_fields.tests.GetFieldDisplayTests)", "test_check (model_fields.tests.ChoicesTests)", "test_... | 419a78300f7cd27611196e1e464d50fd0385ff27 | 1-4 hours |
django/django | django__django-11451 | e065b293878b1e3ea56655aa9d33e87576cd77ff | diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py
--- a/django/contrib/auth/backends.py
+++ b/django/contrib/auth/backends.py
@@ -39,6 +39,8 @@ class ModelBackend(BaseBackend):
def authenticate(self, request, username=None, password=None, **kwargs):
if username is None:
... | diff --git a/tests/auth_tests/test_auth_backends.py b/tests/auth_tests/test_auth_backends.py
--- a/tests/auth_tests/test_auth_backends.py
+++ b/tests/auth_tests/test_auth_backends.py
@@ -226,6 +226,19 @@ def test_authentication_timing(self):
authenticate(username='no_such_user', password='test')
self.... | ModelBackend.authenticate() shouldn't make a database query when username is None
Description
It's easier to explain my issue by adding a comment in the current implementation of ModelBackend.authenticate():
def authenticate(self, request, username=None, password=None, **kwargs):
if username is None:
username =... | 2019-06-08T19:11:42Z | 3.0 | ["test_authentication_without_credentials (auth_tests.test_auth_backends.ModelBackendTest)", "test_custom_perms (auth_tests.test_auth_backends.ModelBackendTest)", "test_authentication_without_credentials (auth_tests.test_auth_backends.CustomPermissionsUserModelBackendTest)", "test_custom_perms (auth_tests.test_auth_bac... | ["test_raises_exception (auth_tests.test_auth_backends.NoBackendsTest)", "test_get_all_permissions (auth_tests.test_auth_backends.BaseBackendTest)", "test_get_group_permissions (auth_tests.test_auth_backends.BaseBackendTest)", "test_get_user_permissions (auth_tests.test_auth_backends.BaseBackendTest)", "test_has_perm (... | 419a78300f7cd27611196e1e464d50fd0385ff27 | <15 min fix | |
django/django | django__django-11532 | a5308514fb4bc5086c9a16a8a24a945eeebb073c | diff --git a/django/core/mail/message.py b/django/core/mail/message.py
--- a/django/core/mail/message.py
+++ b/django/core/mail/message.py
@@ -16,7 +16,7 @@
from django.conf import settings
from django.core.mail.utils import DNS_NAME
-from django.utils.encoding import force_str
+from django.utils.encoding import fo... | diff --git a/tests/mail/tests.py b/tests/mail/tests.py
--- a/tests/mail/tests.py
+++ b/tests/mail/tests.py
@@ -14,10 +14,11 @@
from io import StringIO
from smtplib import SMTP, SMTPAuthenticationError, SMTPException
from ssl import SSLError
+from unittest import mock
from django.core import mail
from django.core... | Email messages crash on non-ASCII domain when email encoding is non-unicode.
Description
When the computer hostname is set in unicode (in my case "正宗"), the following test fails: https://github.com/django/django/blob/master/tests/mail/tests.py#L368
Specifically, since the encoding is set to iso-8859-1, Python attemp... | Thanks for the report. Simple encoding should fix this issue, e.g. diff --git a/django/core/mail/utils.py b/django/core/mail/utils.py index d18dfe4667..68f9e464d6 100644 --- a/django/core/mail/utils.py +++ b/django/core/mail/utils.py @@ -14,6 +14,10 @@ class CachedDnsName: def get_fqdn(self): if not hasattr(self, '_fqd... | 2019-07-02T10:29:28Z | 3.0 | ["test_non_ascii_dns_non_unicode_email (mail.tests.MailTests)"] | ["test_7bit (mail.tests.PythonGlobalState)", "test_8bit_latin (mail.tests.PythonGlobalState)", "test_8bit_non_latin (mail.tests.PythonGlobalState)", "test_utf8 (mail.tests.PythonGlobalState)", "test_date_header_localtime (mail.tests.MailTimeZoneTests)", "test_date_header_utc (mail.tests.MailTimeZoneTests)", "test_close... | 419a78300f7cd27611196e1e464d50fd0385ff27 | 15 min - 1 hour |
django/django | django__django-11734 | 999891bd80b3d02dd916731a7a239e1036174885 | diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -2332,10 +2332,6 @@ def get_db_prep_value(self, value, connection, prepared=False):
value = connection.ops.validate_autopk_value(valu... | diff --git a/tests/queries/tests.py b/tests/queries/tests.py
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -6,7 +6,7 @@
from django.core.exceptions import EmptyResultSet, FieldError
from django.db import DEFAULT_DB_ALIAS, connection
-from django.db.models import Count, F, Q
+from django.db.models imp... | OuterRef in exclude() or ~Q() uses wrong model.
Description
The following test (added to tests/queries/test_qs_combinators) fails when trying to exclude results using OuterRef()
def test_exists_exclude(self):
# filter()
qs = Number.objects.annotate(
foo=Exists(
Item.objects.filter(tags__category_id=OuterRef('p... | Thanks for the report. ValueError was fixed in 35431298226165986ad07e91f9d3aca721ff38ec. Provided test fails on master with django.db.utils.ProgrammingError: missing FROM-clause entry for table "V0" LINE 1: ...(U1."tag_id" = U2."id") WHERE U2."category_id" = ("V0"."id")... It looks that OuterRef resolves to "V0"."id" i... | 2019-09-01T18:46:50Z | 3.0 | ["test_subquery_exclude_outerref (queries.tests.ExcludeTests)"] | ["test_ticket8597 (queries.tests.ComparisonTests)", "#13227 -- If a queryset is already evaluated, it can still be used as a query arg", "test_no_fields_cloning (queries.tests.CloneTests)", "test_no_model_options_cloning (queries.tests.CloneTests)", "test_exists (queries.tests.ExistsSql)", "test_ticket_18414 (queries.t... | 419a78300f7cd27611196e1e464d50fd0385ff27 | 15 min - 1 hour |
django/django | django__django-12125 | 89d41cba392b759732ba9f1db4ff29ed47da6a56 | diff --git a/django/db/migrations/serializer.py b/django/db/migrations/serializer.py
--- a/django/db/migrations/serializer.py
+++ b/django/db/migrations/serializer.py
@@ -269,7 +269,7 @@ def serialize(self):
if module == builtins.__name__:
return self.value.__name__, set()
els... | diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
--- a/tests/migrations/test_writer.py
+++ b/tests/migrations/test_writer.py
@@ -26,6 +26,11 @@
from .models import FoodManager, FoodQuerySet
+class DeconstructibleInstances:
+ def deconstruct(self):
+ return ('DeconstructibleI... | makemigrations produces incorrect path for inner classes
Description
When you define a subclass from django.db.models.Field as an inner class of some other class, and use this field inside a django.db.models.Model class, then when you run manage.py makemigrations, a migrations file is created which refers to the inne... | This should be possible to do by relying on __qualname__ (instead of __name__) now that master is Python 3 only.
PR
I think we should focus on using __qualname__ during migration serialization as well instead of simply solving the field subclasses case.
In fb0f987: Fixed #27914 -- Added support for nested classes in F... | 2019-11-22T12:55:45Z | 3.1 | ["test_serialize_nested_class (migrations.test_writer.WriterTests)", "test_serialize_numbers (migrations.test_writer.WriterTests)"] | ["test_args_kwargs_signature (migrations.test_writer.OperationWriterTests)", "test_args_signature (migrations.test_writer.OperationWriterTests)", "test_empty_signature (migrations.test_writer.OperationWriterTests)", "test_expand_args_signature (migrations.test_writer.OperationWriterTests)", "test_kwargs_signature (migr... | 0668164b4ac93a5be79f5b87fae83c657124d9ab | <15 min fix |
django/django | django__django-12304 | 4c1b401e8250f9f520b3c7dc369554477ce8b15a | diff --git a/django/db/models/enums.py b/django/db/models/enums.py
--- a/django/db/models/enums.py
+++ b/django/db/models/enums.py
@@ -31,6 +31,7 @@ def __new__(metacls, classname, bases, classdict):
# that is passed in as "self" as the value to use when looking up the
# label in the choices.
... | diff --git a/tests/model_enums/tests.py b/tests/model_enums/tests.py
--- a/tests/model_enums/tests.py
+++ b/tests/model_enums/tests.py
@@ -4,6 +4,7 @@
import uuid
from django.db import models
+from django.template import Context, Template
from django.test import SimpleTestCase
from django.utils.functional import ... | Enumeration Types are not usable in templates.
Description
(last modified by Mariusz Felisiak)
The new enumeration types are great but can't be used in Django templates due to their being callable. For example this doesn't work:
{% if student.year_in_school == YearInSchool.FRESHMAN %}
This is because YearInSch... | 2020-01-09T15:43:51Z | 3.1 | ["test_templates (model_enums.tests.ChoicesTests)"] | ["test_integerchoices (model_enums.tests.ChoicesTests)", "test_integerchoices_auto_label (model_enums.tests.ChoicesTests)", "test_integerchoices_containment (model_enums.tests.ChoicesTests)", "test_integerchoices_empty_label (model_enums.tests.ChoicesTests)", "test_integerchoices_functional_api (model_enums.tests.Choic... | 0668164b4ac93a5be79f5b87fae83c657124d9ab | <15 min fix | |
django/django | django__django-12325 | 29c126bb349526b5f1cd78facbe9f25906f18563 | diff --git a/django/db/models/base.py b/django/db/models/base.py
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -202,7 +202,7 @@ def __new__(cls, name, bases, attrs, **kwargs):
continue
# Locate OneToOneField instances.
for field in base._meta.local_fields:
-... | diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py
--- a/tests/invalid_models_tests/test_models.py
+++ b/tests/invalid_models_tests/test_models.py
@@ -3,7 +3,6 @@
from django.conf import settings
from django.core.checks import Error, Warning
from django.core.checks.mod... | pk setup for MTI to parent get confused by multiple OneToOne references.
Description
class Document(models.Model):
pass
class Picking(Document):
document_ptr = models.OneToOneField(Document, on_delete=models.CASCADE, parent_link=True, related_name='+')
origin = models.OneToOneField(Document, related_name='picking'... | That seems to be a bug, managed to reproduce. Does the error go away if you add primary_key=True to document_ptr like I assume you wanted to do? This makes me realized that the MTI documentation is not completely correcy, the automatically added `place_ptr` field end up with `primary_key=True`. Not sure why we're not... | 2020-01-15T14:02:25Z | 3.1 | ["test_clash_parent_link (invalid_models_tests.test_relative_fields.ComplexClashTests)", "test_onetoone_with_parent_model (invalid_models_tests.test_models.OtherModelTests)"] | ["test_check_constraints (invalid_models_tests.test_models.ConstraintsTests)", "test_check_constraints_required_db_features (invalid_models_tests.test_models.ConstraintsTests)", "test_accessor_clash (invalid_models_tests.test_relative_fields.SelfReferentialFKClashTests)", "test_clash_under_explicit_related_name (invali... | 0668164b4ac93a5be79f5b87fae83c657124d9ab | 1-4 hours |
django/django | django__django-13158 | 7af8f4127397279d19ef7c7899e93018274e2f9b | diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -305,6 +305,7 @@ def clone(self):
obj.annotation_select_mask = None
else:
obj.annotation_select_mask = self.annotation_select_mask.copy... | diff --git a/tests/queries/test_qs_combinators.py b/tests/queries/test_qs_combinators.py
--- a/tests/queries/test_qs_combinators.py
+++ b/tests/queries/test_qs_combinators.py
@@ -51,6 +51,13 @@ def test_union_distinct(self):
self.assertEqual(len(list(qs1.union(qs2, all=True))), 20)
self.assertEqual(le... | QuerySet.none() on combined queries returns all results.
Description
I came across this issue on Stack Overflow. I'm not 100% sure it's a bug, but it does seem strange. With this code (excuse the bizarre example filtering):
class Publication(models.Model):
pass
class Article(models.Model):
publications = models.Man... | Thanks for the report. QuerySet.none() doesn't work properly on combined querysets, it returns all results instead of an empty queryset. | 2020-07-06T19:18:11Z | 3.2 | ["test_union_none (queries.test_qs_combinators.QuerySetSetOperationTests)"] | ["test_combining_multiple_models (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_count_difference (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_count_intersection (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_count_union (queries.test_qs_combinators.QuerySetSetOperati... | 65dfb06a1ab56c238cc80f5e1c31f61210c4577d | 15 min - 1 hour |
django/django | django__django-13363 | 76e0151ea0e0f56dca66cee846a78b89346d2c4c | diff --git a/django/db/models/functions/datetime.py b/django/db/models/functions/datetime.py
--- a/django/db/models/functions/datetime.py
+++ b/django/db/models/functions/datetime.py
@@ -292,7 +292,7 @@ class TruncDate(TruncBase):
def as_sql(self, compiler, connection):
# Cast to date rather than truncate... | diff --git a/tests/db_functions/datetime/test_extract_trunc.py b/tests/db_functions/datetime/test_extract_trunc.py
--- a/tests/db_functions/datetime/test_extract_trunc.py
+++ b/tests/db_functions/datetime/test_extract_trunc.py
@@ -1124,14 +1124,24 @@ def test_trunc_timezone_applied_before_truncation(self):
mod... | Add support for tzinfo parameter to TruncDate() and TruncTime().
Description
(last modified by Joe Jackson)
Description
TruncDate inherits from TruncBase, which includes the TimeZone mixin. This should allow a developer to pass in a tzinfo object to be used when converting TruncDate, but it actually uses the re... | Please check https://code.djangoproject.com/ticket/31640 Is it related to your issue?
Replying to Serhii Romanov: Please check https://code.djangoproject.com/ticket/31640 Is it related to your issue? It is related, but not exactly my issue. That patch updates the TruncBase as_sql method, and world work. But the TruncDa... | 2020-08-29T18:59:41Z | 3.2 | ["test_trunc_timezone_applied_before_truncation (db_functions.datetime.test_extract_trunc.DateFunctionWithTimeZoneTests)"] | ["test_extract_day_func (db_functions.datetime.test_extract_trunc.DateFunctionTests)", "test_extract_duration_unsupported_lookups (db_functions.datetime.test_extract_trunc.DateFunctionTests)", "test_extract_duration_without_native_duration_field (db_functions.datetime.test_extract_trunc.DateFunctionTests)", "test_extra... | 65dfb06a1ab56c238cc80f5e1c31f61210c4577d | <15 min fix |
django/django | django__django-13401 | 453967477e3ddae704cd739eac2449c0e13d464c | diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -516,17 +516,37 @@ def clone(self):
def __eq__(self, other):
# Needed for @total_ordering
if isinstance(other, Field):
- ... | diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py
--- a/tests/model_fields/tests.py
+++ b/tests/model_fields/tests.py
@@ -102,6 +102,36 @@ def test_deconstruct_nested_field(self):
name, path, args, kwargs = Nested.Field().deconstruct()
self.assertEqual(path, 'model_fields.tests.Ne... | Abstract model field should not be equal across models
Description
Consider the following models:
class A(models.Model):
class Meta:
abstract = True
myfield = IntegerField()
class B(A):
pass
class C(A):
pass
If I pull the fields of B and C into a shared set, one will be de-duplicated away, because they compare ... | 2020-09-09T11:19:00Z | 3.2 | ["Field instances from abstract models are not equal."] | ["test_blank_in_choices (model_fields.tests.GetChoicesTests)", "test_blank_in_grouped_choices (model_fields.tests.GetChoicesTests)", "test_empty_choices (model_fields.tests.GetChoicesTests)", "test_lazy_strings_not_evaluated (model_fields.tests.GetChoicesTests)", "test_get_choices (model_fields.tests.GetChoicesLimitCho... | 65dfb06a1ab56c238cc80f5e1c31f61210c4577d | 15 min - 1 hour | |
django/django | django__django-13406 | 84609b3205905097d7d3038d32e6101f012c0619 | diff --git a/django/db/models/query.py b/django/db/models/query.py
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -210,6 +210,8 @@ def query(self):
@query.setter
def query(self, value):
+ if value.values_select:
+ self._iterable_class = ValuesIterable
self._que... | diff --git a/tests/queryset_pickle/tests.py b/tests/queryset_pickle/tests.py
--- a/tests/queryset_pickle/tests.py
+++ b/tests/queryset_pickle/tests.py
@@ -11,7 +11,7 @@
class PickleabilityTestCase(TestCase):
@classmethod
def setUpTestData(cls):
- Happening.objects.create() # make sure the defaults ar... | Queryset with values()/values_list() crashes when recreated from a pickled query.
Description
I am pickling query objects (queryset.query) for later re-evaluation as per https://docs.djangoproject.com/en/2.2/ref/models/querysets/#pickling-querysets. However, when I tried to rerun a query that combines values and ann... | It seems that I have found the culprit. The queryset has an attribute _iterable_class, which in case of a .objects.all() type of query is ModelIterable, but when .values() is used, it should be ValuesIterable. Unfortunately, this is an attribute of the queryset, not of the query and thus it does not get pickled and unp... | 2020-09-10T12:38:11Z | 3.2 | ["test_annotation_values (queryset_pickle.tests.PickleabilityTestCase)", "test_annotation_values_list (queryset_pickle.tests.PickleabilityTestCase)", "test_annotation_with_callable_default (queryset_pickle.tests.PickleabilityTestCase)"] | ["test_in_lookup_query_evaluation (queryset_pickle.tests.InLookupTests)", "test_in_lookup_queryset_evaluation (queryset_pickle.tests.InLookupTests)", "test_datetime_callable_default_all (queryset_pickle.tests.PickleabilityTestCase)", "test_datetime_callable_default_filter (queryset_pickle.tests.PickleabilityTestCase)",... | 65dfb06a1ab56c238cc80f5e1c31f61210c4577d | <15 min fix |
django/django | django__django-13417 | 71ae1ab0123582cc5bfe0f7d5f4cc19a9412f396 | diff --git a/django/db/models/query.py b/django/db/models/query.py
--- a/django/db/models/query.py
+++ b/django/db/models/query.py
@@ -1224,7 +1224,12 @@ def ordered(self):
return True
if self.query.extra_order_by or self.query.order_by:
return True
- elif self.query.default_or... | diff --git a/tests/queries/tests.py b/tests/queries/tests.py
--- a/tests/queries/tests.py
+++ b/tests/queries/tests.py
@@ -2084,6 +2084,16 @@ def test_annotated_ordering(self):
self.assertIs(qs.ordered, False)
self.assertIs(qs.order_by('num_notes').ordered, True)
+ def test_annotated_default_orde... | QuerySet.ordered property is incorrect for GROUP BY queries on models with Meta.ordering.
Description
Using the annotate function on a queryset doesn't keep the default ordering set in model's meta class.
A property should say whether the queryset will be ordered or not. I wanted to use the qs.ordered property for th... | Thanks for this report, however QuerySet.ordered works for me, see tests.
Replying to felixxm: Thanks for this report, however QuerySet.ordered works for me, see tests. Thanks for your answer but I've just checked again as it is in my example and ordered still returns True if an annotation is applied. As said earlier... | 2020-09-14T07:49:15Z | 3.2 | ["test_annotated_default_ordering (queries.tests.QuerysetOrderedTests)", "test_annotated_values_default_ordering (queries.tests.QuerysetOrderedTests)"] | ["test_no_extra_params (queries.tests.DefaultValuesInsertTest)", "test_ticket14729 (queries.tests.RawQueriesTests)", "test_exists (queries.tests.ExistsSql)", "test_ticket_18414 (queries.tests.ExistsSql)", "test_ticket_24278 (queries.tests.TestTicket24279)", "test_ticket7371 (queries.tests.CustomPkTests)", "test_ticket_... | 65dfb06a1ab56c238cc80f5e1c31f61210c4577d | <15 min fix |
django/django | django__django-13551 | 7f9e4524d6b23424cf44fbe1bf1f4e70f6bb066e | diff --git a/django/contrib/auth/tokens.py b/django/contrib/auth/tokens.py
--- a/django/contrib/auth/tokens.py
+++ b/django/contrib/auth/tokens.py
@@ -78,9 +78,9 @@ def _make_token_with_timestamp(self, user, timestamp, legacy=False):
def _make_hash_value(self, user, timestamp):
"""
- Hash the use... | diff --git a/tests/auth_tests/models/__init__.py b/tests/auth_tests/models/__init__.py
--- a/tests/auth_tests/models/__init__.py
+++ b/tests/auth_tests/models/__init__.py
@@ -8,6 +8,7 @@
from .no_password import NoPasswordUser
from .proxy import Proxy, UserProxy
from .uuid_pk import UUIDUser
+from .with_custom_email... | Changing user's email could invalidate password reset tokens
Description
Sequence:
Have account with email address foo@…
Password reset request for that email (unused)
foo@… account changes their email address
Password reset email is used
The password reset email's token should be rejected at that point, but in fact ... | 2020-10-17T17:22:01Z | 3.2 | ["Updating the user email address invalidates the token.", "test_token_with_different_secret (auth_tests.test_tokens.TokenGeneratorTest)"] | ["test_str (auth_tests.test_models.GroupTests)", "test_group_natural_key (auth_tests.test_models.NaturalKeysTestCase)", "test_user_natural_key (auth_tests.test_models.NaturalKeysTestCase)", "test_check_password (auth_tests.test_models.AnonymousUserTests)", "test_delete (auth_tests.test_models.AnonymousUserTests)", "tes... | 65dfb06a1ab56c238cc80f5e1c31f61210c4577d | <15 min fix | |
django/django | django__django-13741 | d746f28949c009251a8741ba03d156964050717f | diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py
--- a/django/contrib/auth/forms.py
+++ b/django/contrib/auth/forms.py
@@ -56,16 +56,9 @@ class ReadOnlyPasswordHashField(forms.Field):
def __init__(self, *args, **kwargs):
kwargs.setdefault("required", False)
+ kwargs.setdef... | diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -1022,6 +1022,7 @@ def test_render(self):
def test_readonly_field_has_changed(self):
field = ReadOnlyPasswordHashField()
+ self.assertIs(field.... | Set disabled prop on ReadOnlyPasswordHashField
Description
Currently the django.contrib.auth.forms.UserChangeForm defines a clean_password method that returns the initial password value to prevent (accidental) changes to the password value. It is also documented that custom forms for the User model need to define thi... | Sounds good. Would you like to provide a patch?
Replying to Mariusz Felisiak: Sounds good. Would you like to provide a patch? I don't have the time to do a proper patch (with doc changes and additional tests). But I marked it as "Easy pickings" to entice others that are trying to get into contribution to Django ;-)
I'd... | 2020-12-02T10:52:52Z | 3.2 | ["test_readonly_field_has_changed (auth_tests.test_forms.ReadOnlyPasswordHashTest)"] | ["test_field_order (auth_tests.test_forms.PasswordChangeFormTest)", "test_html_autocomplete_attributes (auth_tests.test_forms.PasswordChangeFormTest)", "test_incorrect_password (auth_tests.test_forms.PasswordChangeFormTest)", "test_password_verification (auth_tests.test_forms.PasswordChangeFormTest)", "test_password_wh... | 65dfb06a1ab56c238cc80f5e1c31f61210c4577d | <15 min fix |
django/django | django__django-14034 | db1fc5cd3c5d36cdb5d0fe4404efd6623dd3e8fb | diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py
--- a/django/forms/boundfield.py
+++ b/django/forms/boundfield.py
@@ -2,7 +2,7 @@
from django.core.exceptions import ValidationError
from django.forms.utils import flatatt, pretty_name
-from django.forms.widgets import Textarea, TextInput
+from dj... | diff --git a/tests/forms_tests/field_tests/test_multivaluefield.py b/tests/forms_tests/field_tests/test_multivaluefield.py
--- a/tests/forms_tests/field_tests/test_multivaluefield.py
+++ b/tests/forms_tests/field_tests/test_multivaluefield.py
@@ -10,6 +10,20 @@
beatles = (('J', 'John'), ('P', 'Paul'), ('G', 'George'),... | MultiValueField ignores a required value of a sub field
Description
(last modified by Takayuki Hirai)
A field and a form definition:
from django.forms import (
Form,
CharField,
MultiValueField,
MultiWidget,
)
class MF(MultiValueField):
widget = MultiWidget
def __init__(self):
fields = [
CharField(req... | Why do you pass required=False in super(MF, self).__init__()? Removing that seems to resolve the issue.
I tried to remove required=False, then both INPUT elements in HTML became required. <tr><th><label for="id_mf_0">Mf:</label></th><td><input type="text" name="mf_0" required id="id_mf_0" /> <input type="text" name="mf... | 2021-02-22T19:32:50Z | 4.0 | ["test_render_required_attributes (forms_tests.field_tests.test_multivaluefield.MultiValueFieldTest)"] | ["test_bad_choice (forms_tests.field_tests.test_multivaluefield.MultiValueFieldTest)", "test_clean (forms_tests.field_tests.test_multivaluefield.MultiValueFieldTest)", "test_clean_disabled_multivalue (forms_tests.field_tests.test_multivaluefield.MultiValueFieldTest)", "test_disabled_has_changed (forms_tests.field_tests... | 475cffd1d64c690cdad16ede4d5e81985738ceb4 | 15 min - 1 hour |
django/django | django__django-14089 | d01709aae21de9cd2565b9c52f32732ea28a2d98 | diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py
--- a/django/utils/datastructures.py
+++ b/django/utils/datastructures.py
@@ -25,6 +25,9 @@ def discard(self, item):
def __iter__(self):
return iter(self.dict)
+ def __reversed__(self):
+ return reversed(self.dict)
+
... | diff --git a/tests/utils_tests/test_datastructures.py b/tests/utils_tests/test_datastructures.py
--- a/tests/utils_tests/test_datastructures.py
+++ b/tests/utils_tests/test_datastructures.py
@@ -1,7 +1,7 @@
"""
Tests for stuff in django.utils.datastructures.
"""
-
+import collections.abc
import copy
import pickle
... | Allow calling reversed() on an OrderedSet
Description
Currently, OrderedSet isn't reversible (i.e. allowed to be passed as an argument to Python's reversed()). This would be natural to support given that OrderedSet is ordered. This should be straightforward to add by adding a __reversed__() method to OrderedSet.
| 2021-03-06T20:51:08Z | 4.0 | ["test_reversed (utils_tests.test_datastructures.OrderedSetTests)"] | ["test_copy (utils_tests.test_datastructures.CaseInsensitiveMappingTests)", "test_create_with_invalid_key (utils_tests.test_datastructures.CaseInsensitiveMappingTests)", "test_create_with_invalid_values (utils_tests.test_datastructures.CaseInsensitiveMappingTests)", "test_del (utils_tests.test_datastructures.CaseInsens... | 475cffd1d64c690cdad16ede4d5e81985738ceb4 | <15 min fix | |
django/django | django__django-14915 | 903aaa35e5ceaa33bfc9b19b7f6da65ce5a91dd4 | diff --git a/django/forms/models.py b/django/forms/models.py
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -1166,6 +1166,9 @@ def __init__(self, value, instance):
def __str__(self):
return str(self.value)
+ def __hash__(self):
+ return hash(self.value)
+
def __eq__(self, ot... | diff --git a/tests/model_forms/test_modelchoicefield.py b/tests/model_forms/test_modelchoicefield.py
--- a/tests/model_forms/test_modelchoicefield.py
+++ b/tests/model_forms/test_modelchoicefield.py
@@ -2,7 +2,7 @@
from django import forms
from django.core.exceptions import ValidationError
-from django.forms.models... | ModelChoiceIteratorValue is not hashable.
Description
Recently I migrated from Django 3.0 to Django 3.1. In my code, I add custom data-* attributes to the select widget options. After the upgrade some of those options broke. Error is {TypeError}unhashable type: 'ModelChoiceIteratorValue'.
Example (this one breaks):
... | Thanks for the ticket. Agreed, we could make ModelChoiceIteratorValue hashable by adding: def __hash__(self): return hash(self.value) For now you can use value.value as documented in the "Backwards incompatible changes in 3.1" section. Would you like to prepare a patch?
Replying to Mariusz Felisiak: Thanks for the tic... | 2021-09-29T22:00:15Z | 4.1 | ["test_choice_value_hash (model_forms.test_modelchoicefield.ModelChoiceFieldTests)"] | ["test_basics (model_forms.test_modelchoicefield.ModelChoiceFieldTests)", "test_choice_iterator_passes_model_to_widget (model_forms.test_modelchoicefield.ModelChoiceFieldTests)", "test_choices (model_forms.test_modelchoicefield.ModelChoiceFieldTests)", "test_choices_bool (model_forms.test_modelchoicefield.ModelChoiceFi... | 647480166bfe7532e8c471fef0146e3a17e6c0c9 | <15 min fix |
django/django | django__django-15022 | e1d673c373a7d032060872b690a92fc95496612e | diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -1031,6 +1031,7 @@ def construct_search(field_name):
if search_fields and search_term:
orm_lookups = [construct_search(str(search_field))
... | diff --git a/tests/admin_changelist/admin.py b/tests/admin_changelist/admin.py
--- a/tests/admin_changelist/admin.py
+++ b/tests/admin_changelist/admin.py
@@ -36,6 +36,12 @@ class ParentAdmin(admin.ModelAdmin):
list_select_related = ['child']
+class ParentAdminTwoSearchFields(admin.ModelAdmin):
+ list_filte... | Unnecessary joins in admin changelist query
Description
Django 1.2.5
Models:
class Client(models.Model):
name = models.CharField(_('name'), max_length=256)
name2 = models.CharField(_('unofficial or obsolete name'), max_length=256, blank=True, null=True)
contact_person = models.CharField(_('contact person'), max_le... | patch has been made from Mercurial repository
This seems related to #13902 and #15819. Are you able to test if this gets fixed by using Django 1.3 or trunk?
Looking at the code, the part that is modified by the patch is not modified in current trunk. The problematic pattern is still there: for bit in self.query.split()... | 2021-10-24T17:48:28Z | 4.1 | ["test_many_search_terms (admin_changelist.tests.ChangeListTests)", "All rows containing each of the searched words are returned, where each", "Searches over multi-valued relationships return rows from related"] | ["{% get_admin_log %} works if the user model's primary key isn't named", "test_missing_args (admin_changelist.tests.GetAdminLogTests)", "{% get_admin_log %} works without specifying a user.", "test_non_integer_limit (admin_changelist.tests.GetAdminLogTests)", "test_without_as (admin_changelist.tests.GetAdminLogTests)"... | 647480166bfe7532e8c471fef0146e3a17e6c0c9 | 15 min - 1 hour |
django/django | django__django-15268 | 0ab58c120939093fea90822f376e1866fc714d1f | diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
--- a/django/db/migrations/operations/models.py
+++ b/django/db/migrations/operations/models.py
@@ -34,9 +34,12 @@ def references_model(self, name, app_label):
def reduce(self, operation, app_label):
return ... | diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py
--- a/tests/migrations/test_autodetector.py
+++ b/tests/migrations/test_autodetector.py
@@ -1573,21 +1573,13 @@ def test_foo_together_ordering(self):
self.assertOperationTypes(changes, 'otherapp', 0, [
'Alte... | Optimize multiple AlterFooTogether operations into one
Description
Hi,
In #31503 we split the AlterFooTogether (AlterUniqueTogether and AlterIndexTogether) operations into two types of operations.
First, a migration will have operations to remove constraints, and then other operations adds the new constraints. This a... | 2022-01-01T09:57:13Z | 4.1 | ["index/unique_together also triggers on ordering changes.", "Removed fields will be removed after updating index/unique_together.", "Fields are renamed before updating index/unique_together."] | ["test_auto (migrations.test_autodetector.MigrationSuggestNameTests)", "test_many_operations_suffix (migrations.test_autodetector.MigrationSuggestNameTests)", "test_no_operations (migrations.test_autodetector.MigrationSuggestNameTests)", "test_no_operations_initial (migrations.test_autodetector.MigrationSuggestNameTest... | 647480166bfe7532e8c471fef0146e3a17e6c0c9 | 1-4 hours | |
django/django | django__django-15503 | 859a87d873ce7152af73ab851653b4e1c3ffea4c | diff --git a/django/db/models/fields/json.py b/django/db/models/fields/json.py
--- a/django/db/models/fields/json.py
+++ b/django/db/models/fields/json.py
@@ -172,6 +172,10 @@ def as_sql(self, compiler, connection):
class HasKeyLookup(PostgresOperatorLookup):
logical_operator = None
+ def compile_json_path_f... | diff --git a/tests/model_fields/test_jsonfield.py b/tests/model_fields/test_jsonfield.py
--- a/tests/model_fields/test_jsonfield.py
+++ b/tests/model_fields/test_jsonfield.py
@@ -576,6 +576,33 @@ def test_has_any_keys(self):
[self.objs[3], self.objs[4], self.objs[6]],
)
+ def test_has_key_num... | has_key, has_keys, and has_any_keys JSONField() lookups don't handle numeric keys on SQLite, MySQL, and Oracle.
Description
(last modified by TheTerrasque)
Problem
When using models.JSONField() has_key lookup with numerical keys on SQLite database it fails to find the keys.
Versions:
Django: 4.0.3
Python: 3.9... | Duplicate of #30566, see comment.
Not a duplicate of #30566 This is django's models.JSONField() not postgres extension JSONField It works as expected on Postgresql, the bug is on SQLite #30566 goes directly against comments for https://code.djangoproject.com/ticket/29504 If different behavior is expected on SQLite (or ... | 2022-03-12T06:22:37Z | 4.1 | ["test_has_key_number (model_fields.test_jsonfield.TestQuerying)", "test_has_keys (model_fields.test_jsonfield.TestQuerying)"] | ["test_formfield (model_fields.test_jsonfield.TestFormField)", "test_formfield_custom_encoder_decoder (model_fields.test_jsonfield.TestFormField)", "test_custom_encoder (model_fields.test_jsonfield.TestValidation)", "test_invalid_decoder (model_fields.test_jsonfield.TestValidation)", "test_invalid_encoder (model_fields... | 647480166bfe7532e8c471fef0146e3a17e6c0c9 | 1-4 hours |
django/django | django__django-16032 | 0c3981eb5094419fe200eb46c71b5376a2266166 | diff --git a/django/db/models/fields/related_lookups.py b/django/db/models/fields/related_lookups.py
--- a/django/db/models/fields/related_lookups.py
+++ b/django/db/models/fields/related_lookups.py
@@ -93,7 +93,6 @@ def get_prep_lookup(self):
elif not getattr(self.rhs, "has_select_fields", True) and not g... | diff --git a/tests/annotations/tests.py b/tests/annotations/tests.py
--- a/tests/annotations/tests.py
+++ b/tests/annotations/tests.py
@@ -989,6 +989,34 @@ def test_annotation_filter_with_subquery(self):
publisher_books_qs, [{"name": "Sams"}, {"name": "Morgan Kaufmann"}]
)
+ def test_annotati... | __in doesn't clear selected fields on the RHS when QuerySet.alias() is used after annotate().
Description
Here is a test case to reproduce the bug, you can add this in tests/annotations/tests.py
def test_annotation_and_alias_filter_in_subquery(self):
long_books_qs = (
Book.objects.filter(
pages__gt=400,
... | This is a documented and expected behavior.
Using either .alias or .annotate works as expected without using .values to limit to 1 column. Why is that? but using both of them doesn't seem work.
Replying to Gabriel Muj: Using either .alias or .annotate works as expected without using .values to limit to 1 column. Why i... | 2022-09-06T09:54:57Z | 4.2 | ["test_annotation_and_alias_filter_in_subquery (annotations.tests.NonAggregateAnnotationTestCase)", "test_annotation_and_alias_filter_related_in_subquery (annotations.tests.NonAggregateAnnotationTestCase)"] | ["test_aggregate_alias (annotations.tests.AliasTests)", "test_alias_after_annotation (annotations.tests.AliasTests)", "test_alias_annotate_with_aggregation (annotations.tests.AliasTests)", "test_alias_annotation_expression (annotations.tests.AliasTests)", "test_alias_default_alias_expression (annotations.tests.AliasTes... | 0fbdb9784da915fce5dcc1fe82bac9b4785749e5 | 15 min - 1 hour |
django/django | django__django-16100 | c6350d594c359151ee17b0c4f354bb44f28ff69e | diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -2011,15 +2011,17 @@ def changelist_view(self, request, extra_context=None):
)
if formset.is_valid():
changecount = 0
-... | diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py
--- a/tests/admin_changelist/tests.py
+++ b/tests/admin_changelist/tests.py
@@ -1,4 +1,5 @@
import datetime
+from unittest import mock
from django.contrib import admin
from django.contrib.admin.models import LogEntry
@@ -16,12 +17,12 @@... | Add transaction handling to Changelist list_editable processing.
Description
It seems that changelist_view in Django admin is missing a transaction. Since the view may change data in database, it should be wrapped in a transaction to prevent unexpected states in case of errors.
| So, this has never been wrapped in a transaction. See https://github.com/django/django/commit/7bc0878922 where it was added. Happy to accept as a New Feature to investigate adding that. (I can't immediately see any obvious blockers.) | 2022-09-24T13:32:02Z | 4.2 | ["test_list_editable_atomicity (admin_changelist.tests.ChangeListTests)"] | ["{% get_admin_log %} works if the user model's primary key isn't named", "test_missing_args (admin_changelist.tests.GetAdminLogTests)", "{% get_admin_log %} works without specifying a user.", "test_non_integer_limit (admin_changelist.tests.GetAdminLogTests)", "test_without_as (admin_changelist.tests.GetAdminLogTests)"... | 0fbdb9784da915fce5dcc1fe82bac9b4785749e5 | <15 min fix |
django/django | django__django-16493 | e3a4cee081cf60650b8824f0646383b79cb110e7 | diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py
--- a/django/db/models/fields/files.py
+++ b/django/db/models/fields/files.py
@@ -295,8 +295,9 @@ def deconstruct(self):
if kwargs.get("max_length") == 100:
del kwargs["max_length"]
kwargs["upload_to"] = self... | diff --git a/tests/file_storage/models.py b/tests/file_storage/models.py
--- a/tests/file_storage/models.py
+++ b/tests/file_storage/models.py
@@ -9,7 +9,7 @@
import tempfile
from pathlib import Path
-from django.core.files.storage import FileSystemStorage
+from django.core.files.storage import FileSystemStorage, d... | Callable storage on FileField fails to deconstruct when it returns default_storage
Description
If the storage argument on a FileField is set to a callable that returns default_storage, it is omitted from the deconstructed form of the field, rather than being included as a reference to the callable as expected.
For ex... | Yes, OK. That looks correct. We're essentially saying that when hasattr(self, "_storage_callable") that should unconditionally be used by deconstruct. 🤔
We should probably use getattr(self, "_storage_callable", self.storage) in both lines. | 2023-01-20T18:29:25Z | 5.0 | ["A callable that returns default_storage is not omitted when"] | ["test_deconstruction (file_storage.tests.FileSystemStorageTests.test_deconstruction)", "FileSystemStorage.__init__() shouldn't evaluate base_url.", "test_deprecation_warning (file_storage.tests.GetStorageClassTests.test_deprecation_warning)", "get_storage_class returns the class for a storage backend name/path.", "get... | 4a72da71001f154ea60906a2f74898d32b7322a7 | 15 min - 1 hour |
matplotlib/matplotlib | matplotlib__matplotlib-20859 | 64619e53e9d0ed417daba287ac0d3a06943a54d5 | diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py
--- a/lib/matplotlib/legend.py
+++ b/lib/matplotlib/legend.py
@@ -360,7 +360,7 @@ def __init__(
"""
# local import only to avoid circularity
from matplotlib.axes import Axes
- from matplotlib.figure import Figure
+ ... | diff --git a/lib/matplotlib/tests/test_legend.py b/lib/matplotlib/tests/test_legend.py
--- a/lib/matplotlib/tests/test_legend.py
+++ b/lib/matplotlib/tests/test_legend.py
@@ -871,3 +871,12 @@ def test_handlerline2d():
handles = [mlines.Line2D([0], [0], marker="v")]
leg = ax.legend(handles, ["Aardvark"], numpo... | Adding a legend to a `SubFigure` doesn't work
<!--To help us understand and resolve your issue, please fill out the form to the best of your ability.-->
<!--You can feel free to delete the sections that do not apply.-->
### Bug report
**Bug summary**
<!--A short 1-2 sentences that succinctly describes the bug... | Yep that was just an oversight, not a design decision ;-)
I don't want to complicate this too much, but a further issue arrises even after changing the line I suggest above (let me know if this should be a separate issue)
```python
fig = plt.figure()
subfig = fig.subfigures()
ax = subfig.subplots()
ax.plot([0, 1... | 2021-08-19T09:03:04Z | 3.4 | ["lib/matplotlib/tests/test_legend.py::test_subfigure_legend"] | ["lib/matplotlib/tests/test_legend.py::test_legend_ordereddict", "lib/matplotlib/tests/test_legend.py::test_legend_auto1[png]", "lib/matplotlib/tests/test_legend.py::test_legend_auto1[pdf]", "lib/matplotlib/tests/test_legend.py::test_legend_auto2[png]", "lib/matplotlib/tests/test_legend.py::test_legend_auto2[pdf]", "li... | f93c0a3dcb82feed0262d758626c90d4002685f3 | <15 min fix |
matplotlib/matplotlib | matplotlib__matplotlib-25479 | 7fdf772201e4c9bafbc16dfac23b5472d6a53fa2 | diff --git a/lib/matplotlib/cm.py b/lib/matplotlib/cm.py
--- a/lib/matplotlib/cm.py
+++ b/lib/matplotlib/cm.py
@@ -146,6 +146,11 @@ def register(self, cmap, *, name=None, force=False):
"that was already in the registry.")
self._cmaps[name] = cmap.copy()
+ # Someone may ... | diff --git a/lib/matplotlib/tests/test_colors.py b/lib/matplotlib/tests/test_colors.py
--- a/lib/matplotlib/tests/test_colors.py
+++ b/lib/matplotlib/tests/test_colors.py
@@ -195,10 +195,10 @@ def test_colormap_equals():
# Make sure we can compare different sizes without failure
cm_copy._lut = cm_copy._lut[:1... | Confusing (broken?) colormap name handling
Consider the following example in which one creates and registers a new colormap and attempt to use it with the `pyplot` interface.
``` python
from matplotlib import cm
from matplotlib.colors import LinearSegmentedColormap
import matplotlib.pyplot as plt
import matplotlib
mat... | Seems like the issue is coming up in the `set_cmap` function: https://github.com/matplotlib/matplotlib/blob/bb75f737a28f620fe023742f59dc6ed4f53b094f/lib/matplotlib/pyplot.py#L2072-L2078
The name you pass to that function is only used to grab the colormap, but this doesn't account for the fact that in the internal list... | 2023-03-16T17:59:41Z | 3.7 | ["lib/matplotlib/tests/test_colors.py::test_colormap_equals", "lib/matplotlib/tests/test_colors.py::test_set_cmap_mismatched_name"] | ["lib/matplotlib/tests/test_colors.py::test_create_lookup_table[5-result0]", "lib/matplotlib/tests/test_colors.py::test_create_lookup_table[2-result1]", "lib/matplotlib/tests/test_colors.py::test_create_lookup_table[1-result2]", "lib/matplotlib/tests/test_colors.py::test_index_dtype[uint8]", "lib/matplotlib/tests/test_... | 0849036fd992a2dd133a0cffc3f84f58ccf1840f | <15 min fix |
mwaskom/seaborn | mwaskom__seaborn-3069 | 54cab15bdacfaa05a88fbc5502a5b322d99f148e | diff --git a/seaborn/_core/plot.py b/seaborn/_core/plot.py
--- a/seaborn/_core/plot.py
+++ b/seaborn/_core/plot.py
@@ -25,7 +25,7 @@
from seaborn._stats.base import Stat
from seaborn._core.data import PlotData
from seaborn._core.moves import Move
-from seaborn._core.scales import Scale
+from seaborn._core.scales imp... | diff --git a/tests/_core/test_plot.py b/tests/_core/test_plot.py
--- a/tests/_core/test_plot.py
+++ b/tests/_core/test_plot.py
@@ -645,6 +645,28 @@ def test_undefined_variable_raises(self):
with pytest.raises(RuntimeError, match=err):
p.plot()
+ def test_nominal_x_axis_tweaks(self):
+
+ ... | Nominal scale should be drawn the same way as categorical scales
Three distinctive things happen on the categorical axis in seaborn's categorical plots:
1. The scale is drawn to +/- 0.5 from the first and last tick, rather than using the normal margin logic
2. A grid is not shown, even when it otherwise would be wi... | 2022-10-09T23:31:20Z | 0.12 | ["tests/_core/test_plot.py::TestScaling::test_nominal_x_axis_tweaks", "tests/_core/test_plot.py::TestScaling::test_nominal_y_axis_tweaks"] | ["tests/_core/test_plot.py::TestInit::test_empty", "tests/_core/test_plot.py::TestInit::test_data_only", "tests/_core/test_plot.py::TestInit::test_df_and_named_variables", "tests/_core/test_plot.py::TestInit::test_df_and_mixed_variables", "tests/_core/test_plot.py::TestInit::test_vector_variables_only", "tests/_core/te... | d25872b0fc99dbf7e666a91f59bd4ed125186aa1 | 15 min - 1 hour | |
pydata/xarray | pydata__xarray-3305 | 69c7e01e5167a3137c285cb50d1978252bb8bcbf | diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py
--- a/xarray/core/dataset.py
+++ b/xarray/core/dataset.py
@@ -4768,7 +4768,10 @@ def quantile(
# the former is often more efficient
reduce_dims = None
variables[name] = var.qua... | diff --git a/xarray/tests/test_dataarray.py b/xarray/tests/test_dataarray.py
--- a/xarray/tests/test_dataarray.py
+++ b/xarray/tests/test_dataarray.py
@@ -2298,17 +2298,17 @@ def test_reduce_out(self):
with pytest.raises(TypeError):
orig.mean(out=np.ones(orig.shape))
- # skip due to bug in ol... | DataArray.quantile does not honor `keep_attrs`
#### MCVE Code Sample
<!-- In order for the maintainers to efficiently understand and prioritize issues, we ask you post a "Minimal, Complete and Verifiable Example" (MCVE): http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports -->
```python
# Your code h... | Looking at the code, I'm confused. The DataArray.quantile method creates a temporary dataset, copies the variable over, calls the Variable.quantile method, then assigns the attributes from the dataset to this new variable. At no point however are attributes assigned to this temporary dataset. My understanding is that V... | 2019-09-12T19:27:14Z | 0.12 | ["xarray/tests/test_dataarray.py::TestDataArray::test_quantile"] | ["xarray/tests/test_dataarray.py::TestDataArray::test_properties", "xarray/tests/test_dataarray.py::TestDataArray::test_data_property", "xarray/tests/test_dataarray.py::TestDataArray::test_indexes", "xarray/tests/test_dataarray.py::TestDataArray::test_get_index", "xarray/tests/test_dataarray.py::TestDataArray::test_get... | 1c198a191127c601d091213c4b3292a8bb3054e1 | 15 min - 1 hour |
pydata/xarray | pydata__xarray-3677 | ef6e6a7b86f8479b9a1fecf15ad5b88a2326b31e | diff --git a/xarray/core/dataset.py b/xarray/core/dataset.py
--- a/xarray/core/dataset.py
+++ b/xarray/core/dataset.py
@@ -3604,6 +3604,7 @@ def merge(
If any variables conflict (see ``compat``).
"""
_check_inplace(inplace)
+ other = other.to_dataset() if isinstance(other, xr.DataA... | diff --git a/xarray/tests/test_merge.py b/xarray/tests/test_merge.py
--- a/xarray/tests/test_merge.py
+++ b/xarray/tests/test_merge.py
@@ -3,6 +3,7 @@
import xarray as xr
from xarray.core import dtypes, merge
+from xarray.testing import assert_identical
from . import raises_regex
from .test_dataset import creat... | Merging dataArray into dataset using dataset method fails
While it's possible to merge a dataset and a dataarray object using the top-level `merge()` function, if you try the same thing with the `ds.merge()` method it fails.
```python
import xarray as xr
ds = xr.Dataset({'a': 0})
da = xr.DataArray(1, name='b')
... | 2020-01-09T16:07:14Z | 0.12 | ["xarray/tests/test_merge.py::TestMergeMethod::test_merge_dataarray"] | ["xarray/tests/test_merge.py::TestMergeInternals::test_broadcast_dimension_size", "xarray/tests/test_merge.py::TestMergeFunction::test_merge_arrays", "xarray/tests/test_merge.py::TestMergeFunction::test_merge_datasets", "xarray/tests/test_merge.py::TestMergeFunction::test_merge_dataarray_unnamed", "xarray/tests/test_me... | 1c198a191127c601d091213c4b3292a8bb3054e1 | 15 min - 1 hour | |
pydata/xarray | pydata__xarray-4687 | d3b6aa6d8b997df115a53c001d00222a0f92f63a | diff --git a/xarray/core/computation.py b/xarray/core/computation.py
--- a/xarray/core/computation.py
+++ b/xarray/core/computation.py
@@ -1727,7 +1727,7 @@ def dot(*arrays, dims=None, **kwargs):
return result.transpose(*all_dims, missing_dims="ignore")
-def where(cond, x, y):
+def where(cond, x, y, keep_attrs... | diff --git a/xarray/tests/test_computation.py b/xarray/tests/test_computation.py
--- a/xarray/tests/test_computation.py
+++ b/xarray/tests/test_computation.py
@@ -1922,6 +1922,15 @@ def test_where() -> None:
assert_identical(expected, actual)
+def test_where_attrs() -> None:
+ cond = xr.DataArray([True, Fal... | xr.where not preserving attributes
<!-- Please include a self-contained copy-pastable example that generates the issue if possible.
Please be concise with code posted. See guidelines below on how to provide a good bug report:
- Craft Minimal Bug Reports: http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-... | this also came up in #4141, where we proposed to work around this by using `DataArray.where` (as far as I can tell this doesn't work for you, though).
There are two issues here: first of all, by default `DataArray.__eq__` removes the attributes, so without calling `xr.set_options(keep_attrs=True)` `data == 1` won't ... | 2020-12-13T20:42:40Z | 0.12 | ["xarray/tests/test_computation.py::test_where_attrs"] | ["xarray/tests/test_computation.py::test_signature_properties", "xarray/tests/test_computation.py::test_result_name", "xarray/tests/test_computation.py::test_ordered_set_union", "xarray/tests/test_computation.py::test_ordered_set_intersection", "xarray/tests/test_computation.py::test_join_dict_keys", "xarray/tests/test... | 1c198a191127c601d091213c4b3292a8bb3054e1 | 15 min - 1 hour |
pylint-dev/pylint | pylint-dev__pylint-7080 | 3c5eca2ded3dd2b59ebaf23eb289453b5d2930f0 | diff --git a/pylint/lint/expand_modules.py b/pylint/lint/expand_modules.py
--- a/pylint/lint/expand_modules.py
+++ b/pylint/lint/expand_modules.py
@@ -52,6 +52,7 @@ def _is_ignored_file(
ignore_list_re: list[Pattern[str]],
ignore_list_paths_re: list[Pattern[str]],
) -> bool:
+ element = os.path.normpath(e... | diff --git a/tests/test_self.py b/tests/test_self.py
--- a/tests/test_self.py
+++ b/tests/test_self.py
@@ -1330,6 +1330,27 @@ def test_recursive_current_dir(self):
code=0,
)
+ def test_ignore_path_recursive_current_dir(self) -> None:
+ """Tests that path is normalized b... | `--recursive=y` ignores `ignore-paths`
### Bug description
When running recursively, it seems `ignore-paths` in my settings in pyproject.toml is completely ignored
### Configuration
```ini
[tool.pylint.MASTER]
ignore-paths = [
# Auto generated
"^src/gen/.*$",
]
```
### Command used
```shell
... | @matusvalo Didn't you fix this recently? Or was this a case we overlooked?
https://github.com/PyCQA/pylint/pull/6528.
I will check
I am not able to replicate the issue:
```
(pylint39) matusg@MacBook-Pro:~/dev/pylint/test$ cat src/gen/test.py
import bla
(pylint39) matusg@MacBook-Pro:~/dev/pylint/test$ pylint --... | 2022-06-28T17:24:43Z | 2.15 | ["tests/test_self.py::TestRunTC::test_ignore_path_recursive_current_dir"] | ["tests/test_self.py::TestRunTC::test_pkginfo", "tests/test_self.py::TestRunTC::test_all", "tests/test_self.py::TestRunTC::test_no_ext_file", "tests/test_self.py::TestRunTC::test_w0704_ignored", "tests/test_self.py::TestRunTC::test_exit_zero", "tests/test_self.py::TestRunTC::test_nonexistent_config_file", "tests/test_s... | e90702074e68e20dc8e5df5013ee3ecf22139c3e | 15 min - 1 hour |
pytest-dev/pytest | pytest-dev__pytest-10356 | 3c1534944cbd34e8a41bc9e76818018fadefc9a1 | diff --git a/src/_pytest/mark/structures.py b/src/_pytest/mark/structures.py
--- a/src/_pytest/mark/structures.py
+++ b/src/_pytest/mark/structures.py
@@ -355,12 +355,35 @@ def __call__(self, *args: object, **kwargs: object):
return self.with_args(*args, **kwargs)
-def get_unpacked_marks(obj: object) -> It... | diff --git a/testing/test_mark.py b/testing/test_mark.py
--- a/testing/test_mark.py
+++ b/testing/test_mark.py
@@ -1109,3 +1109,27 @@ def test_foo():
result = pytester.runpytest(foo, "-m", expr)
result.stderr.fnmatch_lines([expected])
assert result.ret == ExitCode.USAGE_ERROR
+
+
+def test_mark_mro() -> ... | Consider MRO when obtaining marks for classes
When using pytest markers in two baseclasses `Foo` and `Bar`, inheriting from both of those baseclasses will lose the markers of one of those classes. This behavior is present in pytest 3-6, and I think it may as well have been intended. I am still filing it as a bug becaus... | ronny has already refactored this multiple times iirc, but I wonder if it would make sense to store markers as `pytestmark_foo` and `pytestmark_bar` on the class instead of in one `pytestmark` array, that way you can leverage regular inheritance rules
Thanks for bringing this to attention, pytest show walk the mro of a... | 2022-10-08T06:20:42Z | 7.2 | ["testing/test_mark.py::test_mark_mro"] | ["testing/test_mark.py::TestMark::test_pytest_exists_in_namespace_all[mark]", "testing/test_mark.py::TestMark::test_pytest_exists_in_namespace_all[param]", "testing/test_mark.py::TestMark::test_pytest_mark_notcallable", "testing/test_mark.py::TestMark::test_mark_with_param", "testing/test_mark.py::TestMark::test_pytest... | 572b5657d7ca557593418ce0319fabff88800c73 | 1-4 hours |
pytest-dev/pytest | pytest-dev__pytest-7571 | 422685d0bdc110547535036c1ff398b5e1c44145 | diff --git a/src/_pytest/logging.py b/src/_pytest/logging.py
--- a/src/_pytest/logging.py
+++ b/src/_pytest/logging.py
@@ -345,6 +345,7 @@ def __init__(self, item: nodes.Node) -> None:
"""Creates a new funcarg."""
self._item = item
# dict of log name -> log level
+ self._initial_handle... | diff --git a/testing/logging/test_fixture.py b/testing/logging/test_fixture.py
--- a/testing/logging/test_fixture.py
+++ b/testing/logging/test_fixture.py
@@ -2,6 +2,7 @@
import pytest
from _pytest.logging import caplog_records_key
+from _pytest.pytester import Testdir
logger = logging.getLogger(__name__)
sublo... | caplog fixture doesn't restore log level after test
From the documentation at https://docs.pytest.org/en/6.0.0/logging.html#caplog-fixture, "The log levels set are restored automatically at the end of the test".
It used to work, but looks broken in new 6.0 release. Minimal example to reproduce:
```
def test_foo(ca... | This probably regressed in fcbaab8b0b89abc622dbfb7982cf9bd8c91ef301. I will take a look. | 2020-07-29T12:00:47Z | 6.0 | ["testing/logging/test_fixture.py::test_change_level_undos_handler_level"] | ["testing/logging/test_fixture.py::test_change_level", "testing/logging/test_fixture.py::test_with_statement", "testing/logging/test_fixture.py::test_log_access", "testing/logging/test_fixture.py::test_messages", "testing/logging/test_fixture.py::test_record_tuples", "testing/logging/test_fixture.py::test_unicode", "te... | 634cde9506eb1f48dec3ec77974ee8dc952207c6 | 15 min - 1 hour |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-13124 | 9f0b959a8c9195d1b6e203f08b698e052b426ca9 | diff --git a/sklearn/model_selection/_split.py b/sklearn/model_selection/_split.py
--- a/sklearn/model_selection/_split.py
+++ b/sklearn/model_selection/_split.py
@@ -576,8 +576,7 @@ class StratifiedKFold(_BaseKFold):
``n_splits`` default value will change from 3 to 5 in v0.22.
shuffle : boolean, op... | diff --git a/sklearn/model_selection/tests/test_split.py b/sklearn/model_selection/tests/test_split.py
--- a/sklearn/model_selection/tests/test_split.py
+++ b/sklearn/model_selection/tests/test_split.py
@@ -493,6 +493,17 @@ def test_shuffle_stratifiedkfold():
assert_not_equal(set(test0), set(test1))
check... | sklearn.model_selection.StratifiedKFold either shuffling is wrong or documentation is misleading
<!--
If your issue is a usage question, submit it here instead:
- StackOverflow with the scikit-learn tag: https://stackoverflow.com/questions/tagged/scikit-learn
- Mailing List: https://mail.python.org/mailman/listinfo/... | thanks for the report.
It's a regression introduced in #7823, the problem is that we're shuffling each stratification in the same way (i.e, with the same random state). I think we should provide different splits when users provide different random state. | 2019-02-09T02:15:23Z | 0.21 | ["sklearn/model_selection/tests/test_split.py::test_shuffle_stratifiedkfold"] | ["sklearn/model_selection/tests/test_split.py::test_cross_validator_with_default_params", "sklearn/model_selection/tests/test_split.py::test_2d_y", "sklearn/model_selection/tests/test_split.py::test_kfold_valueerrors", "sklearn/model_selection/tests/test_split.py::test_kfold_indices", "sklearn/model_selection/tests/tes... | 7813f7efb5b2012412888b69e73d76f2df2b50b6 | 15 min - 1 hour |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-13142 | 1c8668b0a021832386470ddf740d834e02c66f69 | diff --git a/sklearn/mixture/base.py b/sklearn/mixture/base.py
--- a/sklearn/mixture/base.py
+++ b/sklearn/mixture/base.py
@@ -257,11 +257,6 @@ def fit_predict(self, X, y=None):
best_params = self._get_parameters()
best_n_iter = n_iter
- # Always do a final e-step to guarantee... | diff --git a/sklearn/mixture/tests/test_bayesian_mixture.py b/sklearn/mixture/tests/test_bayesian_mixture.py
--- a/sklearn/mixture/tests/test_bayesian_mixture.py
+++ b/sklearn/mixture/tests/test_bayesian_mixture.py
@@ -451,6 +451,15 @@ def test_bayesian_mixture_fit_predict(seed, max_iter, tol):
assert_array_eq... | GaussianMixture predict and fit_predict disagree when n_init>1
#### Description
When `n_init` is specified in GaussianMixture, the results of fit_predict(X) and predict(X) are often different. The `test_gaussian_mixture_fit_predict` unit test doesn't catch this because it does not set `n_init`.
#### Steps/Code to ... | Indeed the code in fit_predict and the one in predict are not exactly consistent. This should be fixed but we would need to check the math to choose the correct variant, add a test and remove the other one.
I don't think the math is wrong or inconsistent. I think it's a matter of `fit_predict` returning the fit from t... | 2019-02-12T14:32:37Z | 0.21 | ["sklearn/mixture/tests/test_bayesian_mixture.py::test_bayesian_mixture_fit_predict_n_init", "sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_fit_predict_n_init"] | ["sklearn/mixture/tests/test_bayesian_mixture.py::test_log_dirichlet_norm", "sklearn/mixture/tests/test_bayesian_mixture.py::test_log_wishart_norm", "sklearn/mixture/tests/test_bayesian_mixture.py::test_bayesian_mixture_covariance_type", "sklearn/mixture/tests/test_bayesian_mixture.py::test_bayesian_mixture_weight_conc... | 7813f7efb5b2012412888b69e73d76f2df2b50b6 | <15 min fix |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-14141 | 3d997697fdd166eff428ea9fd35734b6a8ba113e | diff --git a/sklearn/utils/_show_versions.py b/sklearn/utils/_show_versions.py
--- a/sklearn/utils/_show_versions.py
+++ b/sklearn/utils/_show_versions.py
@@ -48,6 +48,7 @@ def _get_deps_info():
"Cython",
"pandas",
"matplotlib",
+ "joblib",
]
def get_version(module):
| diff --git a/sklearn/utils/tests/test_show_versions.py b/sklearn/utils/tests/test_show_versions.py
--- a/sklearn/utils/tests/test_show_versions.py
+++ b/sklearn/utils/tests/test_show_versions.py
@@ -23,6 +23,7 @@ def test_get_deps_info():
assert 'Cython' in deps_info
assert 'pandas' in deps_info
assert '... | Add joblib in show_versions
joblib should be added to the dependencies listed in show_versions or added to the issue template when sklearn version is > 0.20.
| 2019-06-21T20:53:37Z | 0.22 | ["sklearn/utils/tests/test_show_versions.py::test_get_deps_info"] | ["sklearn/utils/tests/test_show_versions.py::test_get_sys_info", "sklearn/utils/tests/test_show_versions.py::test_show_versions_with_blas"] | 7e85a6d1f038bbb932b36f18d75df6be937ed00d | <15 min fix | |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-25973 | 10dbc142bd17ccf7bd38eec2ac04b52ce0d1009e | diff --git a/sklearn/feature_selection/_sequential.py b/sklearn/feature_selection/_sequential.py
--- a/sklearn/feature_selection/_sequential.py
+++ b/sklearn/feature_selection/_sequential.py
@@ -8,12 +8,12 @@
import warnings
from ._base import SelectorMixin
-from ..base import BaseEstimator, MetaEstimatorMixin, clo... | diff --git a/sklearn/feature_selection/tests/test_sequential.py b/sklearn/feature_selection/tests/test_sequential.py
--- a/sklearn/feature_selection/tests/test_sequential.py
+++ b/sklearn/feature_selection/tests/test_sequential.py
@@ -6,11 +6,12 @@
from sklearn.preprocessing import StandardScaler
from sklearn.pipelin... | Unable to pass splits to SequentialFeatureSelector
### Describe the bug
This runs fine with e.g. `cv=5`, but according to the documentation, it should also be able to take an iterable of splits.
However, passing splits from the cross validator fails
Im fairly certain I have done similar things in the past to other... | The internal algorithm will use the `cv` parameter in a `for` loop. If `cv` is a generator, it will be consumed at the first iteration only. Later it trigger the error because we did not complete the other iteration of the `for` loop.
Passing a list (e.g. `cv=list(splits)`) will solve the problem because we can reus... | 2023-03-25T13:27:07Z | 1.3 | ["sklearn/feature_selection/tests/test_sequential.py::test_cv_generator_support"] | ["sklearn/feature_selection/tests/test_sequential.py::test_bad_n_features_to_select", "sklearn/feature_selection/tests/test_sequential.py::test_n_features_to_select[1-forward]", "sklearn/feature_selection/tests/test_sequential.py::test_n_features_to_select[1-backward]", "sklearn/feature_selection/tests/test_sequential.... | 1e8a5b833d1b58f3ab84099c4582239af854b23a | <15 min fix |
scikit-learn/scikit-learn | scikit-learn__scikit-learn-26323 | 586f4318ffcdfbd9a1093f35ad43e81983740b66 | diff --git a/sklearn/compose/_column_transformer.py b/sklearn/compose/_column_transformer.py
--- a/sklearn/compose/_column_transformer.py
+++ b/sklearn/compose/_column_transformer.py
@@ -293,6 +293,7 @@ def set_output(self, *, transform=None):
Estimator instance.
"""
super().set_output(tr... | diff --git a/sklearn/compose/tests/test_column_transformer.py b/sklearn/compose/tests/test_column_transformer.py
--- a/sklearn/compose/tests/test_column_transformer.py
+++ b/sklearn/compose/tests/test_column_transformer.py
@@ -22,6 +22,7 @@
from sklearn.exceptions import NotFittedError
from sklearn.preprocessing impo... | `ColumnTransformer.set_output` ignores the `remainder` if it's an estimator
### Describe the bug
When using `set_output` on a `ColumnTransformer`, it sets the output to its sub-transformers but it ignores the transformer defined in `remainder`.
This issue causes the following `if` to fail when gathering the resul... | 2023-05-04T11:55:50Z | 1.3 | ["sklearn/compose/tests/test_column_transformer.py::test_remainder_set_output"] | ["sklearn/compose/tests/test_column_transformer.py::test_column_transformer", "sklearn/compose/tests/test_column_transformer.py::test_column_transformer_tuple_transformers_parameter", "sklearn/compose/tests/test_column_transformer.py::test_column_transformer_dataframe", "sklearn/compose/tests/test_column_transformer.py... | 1e8a5b833d1b58f3ab84099c4582239af854b23a | 15 min - 1 hour | |
sphinx-doc/sphinx | sphinx-doc__sphinx-11510 | 6cb783c0024a873722952a67ebb9f41771c8eb6d | diff --git a/sphinx/directives/other.py b/sphinx/directives/other.py
--- a/sphinx/directives/other.py
+++ b/sphinx/directives/other.py
@@ -8,6 +8,7 @@
from docutils.parsers.rst.directives.admonitions import BaseAdmonition
from docutils.parsers.rst.directives.misc import Class
from docutils.parsers.rst.directives.mis... | diff --git a/tests/roots/test-directive-include/baz/baz.rst b/tests/roots/test-directive-include/baz/baz.rst
new file mode 100644
--- /dev/null
+++ b/tests/roots/test-directive-include/baz/baz.rst
@@ -0,0 +1,6 @@
+Baz
+===
+
+.. include:: foo.rst
+
+Baz was here.
\ No newline at end of file
diff --git a/tests/roots/tes... | source-read event does not modify include'd files source
### Describe the bug
In [Yocto documentation](https://git.yoctoproject.org/yocto-docs), we use a custom extension to do some search and replace in literal blocks, see https://git.yoctoproject.org/yocto-docs/tree/documentation/sphinx/yocto-vars.py.
We discover... | Unfortunately, the `source-read` event does not support the `include` directive. So it will not be emitted on inclusion.
>Note that the dumping docname and source[0] shows that the function actually gets called for something-to-include.rst file and its content is correctly replaced in source[0], it just does not mak... | 2023-07-24T22:46:12Z | 7.2 | ["tests/test_directive_other.py::test_include_source_read_event", "tests/test_directive_other.py::test_include_source_read_event_nested_includes"] | ["tests/test_directive_other.py::test_toctree", "tests/test_directive_other.py::test_relative_toctree", "tests/test_directive_other.py::test_toctree_urls_and_titles", "tests/test_directive_other.py::test_toctree_glob", "tests/test_directive_other.py::test_toctree_glob_and_url", "tests/test_directive_other.py::test_reve... | 7758e016231c3886e5a290c00fcb2c75d1f36c18 | 1-4 hours |
sphinx-doc/sphinx | sphinx-doc__sphinx-7454 | aca3f825f2e4a8817190f3c885a242a285aa0dba | diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py
--- a/sphinx/domains/python.py
+++ b/sphinx/domains/python.py
@@ -71,8 +71,13 @@
def _parse_annotation(annotation: str) -> List[Node]:
"""Parse type annotation."""
def make_xref(text: str) -> addnodes.pending_xref:
+ if text == 'None':
+... | diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py
--- a/tests/test_domain_py.py
+++ b/tests/test_domain_py.py
@@ -239,6 +239,7 @@ def test_get_full_qualified_name():
def test_parse_annotation():
doctree = _parse_annotation("int")
assert_node(doctree, ([pending_xref, "int"],))
+ assert_node(do... | Inconsistent handling of None by `autodoc_typehints`
**Describe the bug**
With `autodoc_typehints='description'`, a function that returns `None` generates a clickable link to [None's documentation](https://docs.python.org/3/library/constants.html#None).
With `autodoc_typehints='signature'`, the `None` in the signat... | 2020-04-09T17:08:30Z | 3.0 | ["tests/test_domain_py.py::test_parse_annotation"] | ["tests/test_domain_py.py::test_function_signatures", "tests/test_domain_py.py::test_domain_py_xrefs", "tests/test_domain_py.py::test_domain_py_objects", "tests/test_domain_py.py::test_resolve_xref_for_properties", "tests/test_domain_py.py::test_domain_py_find_obj", "tests/test_domain_py.py::test_get_full_qualified_nam... | 50d2d289e150cb429de15770bdd48a723de8c45d | <15 min fix | |
sphinx-doc/sphinx | sphinx-doc__sphinx-9229 | 876fa81e0a038cda466925b85ccf6c5452e0f685 | diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py
--- a/sphinx/ext/autodoc/__init__.py
+++ b/sphinx/ext/autodoc/__init__.py
@@ -1676,7 +1676,11 @@ def get_object_members(self, want_all: bool) -> Tuple[bool, ObjectMembers]:
def get_doc(self, ignore: int = None) -> Optional[List[List[str]]... | diff --git a/tests/roots/test-ext-autodoc/target/classes.py b/tests/roots/test-ext-autodoc/target/classes.py
--- a/tests/roots/test-ext-autodoc/target/classes.py
+++ b/tests/roots/test-ext-autodoc/target/classes.py
@@ -30,3 +30,6 @@ class Quux(List[Union[int, float]]):
Alias = Foo
+
+#: docstring
+OtherAlias = Bar... | Inconsistent behaviour with type alias documentation (not overwriting all the default messages, just some)
**Describe the bug**
Hello, I have 3 muiltiline docstrings for type aliases (using the next-line `"""` documentation syntax). For 1 one them the docstring is correctly shown in the rendered HTML, but for 2 of the... | 2021-05-15T07:21:49Z | 4.1 | ["tests/test_ext_autodoc_autoclass.py::test_class_alias_having_doccomment"] | ["tests/test_ext_autodoc_autoclass.py::test_classes", "tests/test_ext_autodoc_autoclass.py::test_instance_variable", "tests/test_ext_autodoc_autoclass.py::test_inherited_instance_variable", "tests/test_ext_autodoc_autoclass.py::test_uninitialized_attributes", "tests/test_ext_autodoc_autoclass.py::test_undocumented_unin... | 9a2c3c4a1559e37e95fdee88c128bb116642c897 | 1-4 hours | |
sphinx-doc/sphinx | sphinx-doc__sphinx-9258 | 06107f838c28ab6ca6bfc2cc208e15997fcb2146 | diff --git a/sphinx/domains/python.py b/sphinx/domains/python.py
--- a/sphinx/domains/python.py
+++ b/sphinx/domains/python.py
@@ -304,7 +304,7 @@ def make_xref(self, rolename: str, domain: str, target: str,
def make_xrefs(self, rolename: str, domain: str, target: str,
innernode: Type[TextlikeN... | diff --git a/tests/test_domain_py.py b/tests/test_domain_py.py
--- a/tests/test_domain_py.py
+++ b/tests/test_domain_py.py
@@ -1009,6 +1009,40 @@ def test_info_field_list(app):
**{"py:module": "example", "py:class": "Class"})
+def test_info_field_list_piped_type(app):
+ text = (".. py:module:: e... | [RFE] Support union types specification using | (vertical bar/pipe)
Please add a support for specifying multiple types acceptable for a parameter/attribute/variable.
Use case:
Imagine that there is a function that accepts both `bytes` and `str`. The docstring would look like:
``` restructuredtext
def foo(text):
""... | From [the docs](http://www.sphinx-doc.org/en/stable/domains.html#info-field-lists):
> Multiple types in a type field will be linked automatically if separated by the word “or”:
So this feature is already available using this syntax:
```python
def foo(foo):
"""
Bla blu
:type foo: str or int or N... | 2021-05-21T16:56:41Z | 4.1 | ["tests/test_domain_py.py::test_info_field_list_piped_type"] | ["tests/test_domain_py.py::test_function_signatures", "tests/test_domain_py.py::test_domain_py_xrefs", "tests/test_domain_py.py::test_domain_py_xrefs_abbreviations", "tests/test_domain_py.py::test_domain_py_objects", "tests/test_domain_py.py::test_resolve_xref_for_properties", "tests/test_domain_py.py::test_domain_py_f... | 9a2c3c4a1559e37e95fdee88c128bb116642c897 | <15 min fix |
sympy/sympy | sympy__sympy-14711 | c6753448b5c34f95e250105d76709fe4d349ca1f | diff --git a/sympy/physics/vector/vector.py b/sympy/physics/vector/vector.py
--- a/sympy/physics/vector/vector.py
+++ b/sympy/physics/vector/vector.py
@@ -57,6 +57,8 @@ def __hash__(self):
def __add__(self, other):
"""The add operator for Vector. """
+ if other == 0:
+ return self
... | diff --git a/sympy/physics/vector/tests/test_vector.py b/sympy/physics/vector/tests/test_vector.py
--- a/sympy/physics/vector/tests/test_vector.py
+++ b/sympy/physics/vector/tests/test_vector.py
@@ -13,6 +13,8 @@ def test_Vector():
assert A.y != A.z
assert A.z != A.x
+ assert A.x + 0 == A.x
+
v1 = x... | vector add 0 error
```python
from sympy.physics.vector import ReferenceFrame, Vector
from sympy import symbols
sum([N.x, (0 * N.x)])
```
gives
```
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-inp... | 2018-05-12T17:00:20Z | 1.1 | ["test_Vector"] | ["test_Vector_diffs", "test_vector_var_in_dcm"] | ec9e3c0436fbff934fa84e22bf07f1b3ef5bfac3 | <15 min fix | |
sympy/sympy | sympy__sympy-16766 | b8fe457a02cc24b3470ff678d0099c350b7fef43 | diff --git a/sympy/printing/pycode.py b/sympy/printing/pycode.py
--- a/sympy/printing/pycode.py
+++ b/sympy/printing/pycode.py
@@ -357,6 +357,11 @@ def _print_Not(self, expr):
PREC = precedence(expr)
return self._operators['not'] + self.parenthesize(expr.args[0], PREC)
+ def _print_Indexed(self, ... | diff --git a/sympy/printing/tests/test_pycode.py b/sympy/printing/tests/test_pycode.py
--- a/sympy/printing/tests/test_pycode.py
+++ b/sympy/printing/tests/test_pycode.py
@@ -12,9 +12,10 @@
MpmathPrinter, NumPyPrinter, PythonCodePrinter, pycode, SciPyPrinter
)
from sympy.utilities.pytest import raises
+from symp... | PythonCodePrinter doesn't support Indexed
I use `lambdify()` to generate some functions and save the code for further use. But the generated code for `Indexed` operation has some warnings which can be confirmed by following code;
```
from sympy import *
p = IndexedBase("p")
pycode(p[0])
```
the output is
... | 2019-05-01T22:02:17Z | 1.5 | ["test_PythonCodePrinter"] | ["test_MpmathPrinter", "test_NumPyPrinter", "test_SciPyPrinter", "test_pycode_reserved_words", "test_printmethod", "test_codegen_ast_nodes", "test_issue_14283"] | 70381f282f2d9d039da860e391fe51649df2779d | <15 min fix | |
sympy/sympy | sympy__sympy-23413 | 10de1a18a0efac0b19b611e40c928250dda688bf | diff --git a/sympy/polys/matrices/normalforms.py b/sympy/polys/matrices/normalforms.py
--- a/sympy/polys/matrices/normalforms.py
+++ b/sympy/polys/matrices/normalforms.py
@@ -205,16 +205,19 @@ def _hermite_normal_form(A):
if not A.domain.is_ZZ:
raise DMDomainError('Matrix must be over domain ZZ.')
# ... | diff --git a/sympy/matrices/tests/test_normalforms.py b/sympy/matrices/tests/test_normalforms.py
--- a/sympy/matrices/tests/test_normalforms.py
+++ b/sympy/matrices/tests/test_normalforms.py
@@ -77,5 +77,11 @@ def test_hermite_normal():
assert hermite_normal_form(m) == hnf
m = Matrix([[2, 7], [0, 0], [0, 0]... | bug with HNF removing rows
I expect
`np.flip (hermite_normal_form (Matrix (np.flip (np.array ([[5, 8, 12], [0, 0, 1]]))).T).T))`
to give
`[[5, 8, 0], [0, 0, 1]]`
but instead I get
`[[5, 8, 0]]`
It seems to be falsely identifying my matrix as rank-deficient and removing the row when I try to achieve a row-style... | Seems to depend on where the 1 is when it comes to do the hnf:
```python
>>> hermite_normal_form(Matrix([ # row2
... [0, 12],
... [1, 8],
... [0, 5]]))
Matrix([
[0, 12],
[1, 0],
[0, 5]])
>>> hermite_normal_form(Matrix([ # row3
... [0, 12],
... [0, 8],
... [1, 5]]))
Matrix([
[12, 0],
[ 8, 0],
[ ... | 2022-04-23T23:40:41Z | 1.11 | ["test_hermite_normal"] | ["test_smith_normal", "test_smith_normal_deprecated"] | 9a6104eab0ea7ac191a09c24f3e2d79dcd66bda5 | 15 min - 1 hour |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.