repo
stringclasses
12 values
instance_id
stringlengths
18
32
base_commit
stringlengths
40
40
patch
stringlengths
344
252k
test_patch
stringlengths
398
22.9k
problem_statement
stringlengths
119
25.4k
hints_text
stringlengths
1
55.7k
created_at
stringlengths
20
20
version
float64
0.12
2.02k
FAIL_TO_PASS
stringlengths
12
120k
PASS_TO_PASS
stringlengths
2
114k
environment_setup_commit
stringclasses
89 values
django/django
django__django-16281
2848e5d0ce5cf3c31fe87525536093b21d570f69
diff --git a/django/db/backends/sqlite3/schema.py b/django/db/backends/sqlite3/schema.py --- a/django/db/backends/sqlite3/schema.py +++ b/django/db/backends/sqlite3/schema.py @@ -174,7 +174,7 @@ def alter_field(self, model, old_field, new_field, strict=False): super().alter_field(model, old_field, new_fiel...
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py --- a/tests/migrations/test_operations.py +++ b/tests/migrations/test_operations.py @@ -1796,6 +1796,43 @@ def test_alter_model_table_m2m(self): self.assertTableExists(original_m2m_table) self.assertTableNotExists(n...
Migration changing ManyToManyField target to 'self' doesn't work correctly Description Steps to reproduce: Create Models: class Bar(models.Model): pass class Foo(models.Model): bar = models.ManyToManyField('Bar', blank=True) Migrate: ./manage.py makemigrations app ./manage.py migrate Change type of the ManyToManyFi...
I believe it works correctly as long as the new target model isn't 'self'. Can I check out what you want? You can use 'self' instead of 'Foo' like this : class Foo(models.Model): bar = models.ManyToManyField('self', blank=True) You meant that we should use 'Foo' rather than 'self', right? Replying to SShayashi: Can I c...
2022-11-10T18:52:13Z
4.2
["test_alter_model_table_m2m_field (migrations.test_operations.OperationTests)"]
["#23426 - RunSQL should accept parameters.", "#23426 - RunSQL should fail when a list of statements with an incorrect", "#24098 - Tests no-op RunPython operations.", "#24098 - Tests no-op RunSQL operations.", "#24282 - Model changes to a FK reverse side update the model", "A complex SeparateDatabaseAndState operation:...
0fbdb9784da915fce5dcc1fe82bac9b4785749e5
django/django
django__django-16317
744a1af7f943106e30d538e6ace55c2c66ccd791
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 @@ -732,11 +732,8 @@ def _check_bulk_create_options( "update_fields." ) if unique_fields: - # Primary key is allowed in uni...
diff --git a/tests/bulk_create/tests.py b/tests/bulk_create/tests.py --- a/tests/bulk_create/tests.py +++ b/tests/bulk_create/tests.py @@ -595,6 +595,39 @@ def test_update_conflicts_two_fields_unique_fields_first(self): def test_update_conflicts_two_fields_unique_fields_second(self): self._test_update_con...
QuerySet.bulk_create() crashes on "pk" in unique_fields. Description (last modified by Mariusz Felisiak) QuerySet.bulk_create() crashes on "pk" in unique_fields which should be allowed. File "/django/django/db/backends/utils.py", line 89, in _execute return self.cursor.execute(sql, params) django.db.utils.Pro...
null
2022-11-22T12:08:16Z
4.2
["test_update_conflicts_unique_fields_pk (bulk_create.tests.BulkCreateTests)"]
["Inserting non-ASCII values with a length in the range 2001 to 4000", "Test inserting a large batch with objects having primary key set", "test_batch_same_vals (bulk_create.tests.BulkCreateTests)", "test_bulk_insert_expressions (bulk_create.tests.BulkCreateTests)", "test_bulk_insert_nullable_fields (bulk_create.tests....
0fbdb9784da915fce5dcc1fe82bac9b4785749e5
django/django
django__django-16511
ecafcaf634fcef93f9da8cb12795273dd1c3a576
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 @@ -926,25 +926,32 @@ async def aget_or_create(self, defaults=None, **kwargs): **kwargs, ) - def update_or_create(self, defaults=None, **kwargs): + def update_...
diff --git a/tests/async/test_async_queryset.py b/tests/async/test_async_queryset.py --- a/tests/async/test_async_queryset.py +++ b/tests/async/test_async_queryset.py @@ -99,10 +99,17 @@ async def test_aupdate_or_create(self): id=self.s1.id, defaults={"field": 2} ) self.assertEqual(instan...
Support create defaults for update_or_create Description I proposed the idea of extending update_or_create to support specifying a different set of defaults for the create operation on the [forum](​https://forum.djangoproject.com/t/feature-idea-update-or-create-to-allow-different-defaults-for-create-and-update-operat...
null
2023-01-31T02:40:31Z
5
["If you have a field named create_defaults and want to use it as an", "Should be able to use update_or_create from the m2m related manager to", "Should be able to use update_or_create from the related manager to", "test_aupdate_or_create (async.test_async_queryset.AsyncQuerySetTest.test_aupdate_or_create)", "test_aupd...
["Callables in `defaults` are evaluated if the instance is created.", "Concrete model subclasses with generic relations work", "Create another fatty tagged instance with different PK to ensure there", "Generic relations on a base class (Vegetable) work correctly in", "If Generic Relation is not explicitly defined, any ...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16517
c626173833784c86920b448793ac45005af4c058
diff --git a/django/contrib/admindocs/utils.py b/django/contrib/admindocs/utils.py --- a/django/contrib/admindocs/utils.py +++ b/django/contrib/admindocs/utils.py @@ -101,6 +101,9 @@ def parse_rst(text, default_reference_context, thing_being_parsed=None): def create_reference_role(rolename, urlbase): + # Views ...
diff --git a/tests/admin_docs/test_utils.py b/tests/admin_docs/test_utils.py --- a/tests/admin_docs/test_utils.py +++ b/tests/admin_docs/test_utils.py @@ -104,6 +104,22 @@ def test_parse_rst_with_docstring_no_leading_line_feed(self): self.assertEqual(parse_rst(body, ""), "<p>second line</p>\n") se...
Mixed-case views/templates names causes 404 on :view:/:template: directive. Description ​https://github.com/django/django/blob/main/django/contrib/admindocs/views.py#L168 Using a class based view, class OrderSearch(LoginRequiredMixin, UserPassesTestMixin, ListView): add a doc comment such as :view:orders.views.Order...
Thanks for the ticket. It was originally reported in the #27409 among other issues "For views you can use generic class based views, in there by naming conventions can be capital letters. Class based views are classes and not methods and the naming of the view can be like BlogView or BlogEdit. But if generating link us...
2023-02-01T10:26:17Z
5
["test_parse_rst_template_case_sensitive (admin_docs.test_utils.TestUtils.test_parse_rst_template_case_sensitive)", "test_parse_rst_view_case_sensitive (admin_docs.test_utils.TestUtils.test_parse_rst_view_case_sensitive)"]
["Django shouldn't break the default role for interpreted text", "parse_rst() should use `cmsreference` as the default role.", "test_description_output (admin_docs.test_utils.TestUtils.test_description_output)", "test_initial_header_level (admin_docs.test_utils.TestUtils.test_initial_header_level)", "test_parse_docstri...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16532
ce8189eea007882bbe6db22f86b0965e718bd341
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 @@ -407,20 +407,12 @@ def database_forwards(self, app_label, schema_editor, from_state, to_state): or no...
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py --- a/tests/migrations/test_operations.py +++ b/tests/migrations/test_operations.py @@ -1058,6 +1058,75 @@ def test_rename_model_with_m2m(self): Pony._meta.get_field("riders").remote_field.through.objects.count(), 2 ...
Duplicate model names in M2M relationship causes RenameModel migration failure Description Example code is here: ​https://github.com/jzmiller1/edemo I have a django project with two apps, incidents and vault, that both have a model named Incident. The vault Incident model has an M2M involving the incidents Incident m...
Thanks for the report. Mariusz , if the names of models are same (but different apps), are there any expected names of the cloumns for m2m db table? Can it be incident_id and incidents_incident_id since two db columns cannot have same name? I did some further testing and you don't encounter the same issue going in the ...
2023-02-07T19:32:11Z
5
["test_rename_model_with_m2m_models_in_different_apps_with_same_name (migrations.test_operations.OperationTests.test_rename_model_with_m2m_models_in_different_apps_with_same_name)"]
["#23426 - RunSQL should accept parameters.", "#23426 - RunSQL should fail when a list of statements with an incorrect", "#24098 - Tests no-op RunPython operations.", "#24098 - Tests no-op RunSQL operations.", "#24282 - Model changes to a FK reverse side update the model", "A complex SeparateDatabaseAndState operation:...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16603
4e4eda6d6c8a5867dafd2ba9167ad8c064bb644a
diff --git a/django/core/handlers/asgi.py b/django/core/handlers/asgi.py --- a/django/core/handlers/asgi.py +++ b/django/core/handlers/asgi.py @@ -1,3 +1,4 @@ +import asyncio import logging import sys import tempfile @@ -177,15 +178,49 @@ async def handle(self, scope, receive, send): body_file.close() ...
diff --git a/tests/asgi/tests.py b/tests/asgi/tests.py --- a/tests/asgi/tests.py +++ b/tests/asgi/tests.py @@ -7,8 +7,10 @@ from django.contrib.staticfiles.handlers import ASGIStaticFilesHandler from django.core.asgi import get_asgi_application +from django.core.handlers.asgi import ASGIHandler, ASGIRequest from d...
ASGI http.disconnect not handled on requests with body. Description Noticed whilst reviewing ​PR 15704 for #33699, we're not handling the ASGI http.disconnect message correctly. Since it's only dealt with whilst reading the request body, http.disconnect is not processed on a request that includes a body. ​https://gi...
Thanks! Don't you think it's a bug? 🤔 Don't you think it's a bug? 🤔 I had it down as such, but it's never worked, and once I started thinking about the fix I thought it's probably a non-minor adjustment so... (But happy if you want to re-classify :) Replying to Carlton Gibson: async def read_body(self, receive): """R...
2023-02-27T15:05:05Z
5
["test_assert_in_listen_for_disconnect (asgi.tests.ASGITest.test_assert_in_listen_for_disconnect)", "test_asyncio_cancel_error (asgi.tests.ASGITest.test_asyncio_cancel_error)", "test_disconnect_with_body (asgi.tests.ASGITest.test_disconnect_with_body)"]
["Makes sure that FileResponse works over ASGI.", "get_asgi_application() returns a functioning ASGI callable.", "test_concurrent_async_uses_multiple_thread_pools (asgi.tests.ASGITest.test_concurrent_async_uses_multiple_thread_pools)", "test_delayed_disconnect_with_body (asgi.tests.ASGITest.test_delayed_disconnect_with...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16612
55bcbd8d172b689811fae17cde2f09218dd74e9c
diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py --- a/django/contrib/admin/sites.py +++ b/django/contrib/admin/sites.py @@ -453,7 +453,9 @@ def catch_all_view(self, request, url): pass else: if getattr(match.func, "should_append_slash", True): - ...
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -8463,6 +8463,24 @@ def test_missing_slash_append_slash_true(self): response, known_url, status_code=301, target_status_code=403 ) + @override_settings(APP...
AdminSite.catch_all_view() drops query string in redirects Description #31747 introduced AdminSite.catch_all_view(). However, in the process it broke the ability to redirect with settings.APPEND_SLASH = True when there are query strings. Provided URL: ​http://127.0.0.1:8000/admin/auth/foo?id=123 Expected redirect: ​h...
Thanks for the report! Using get_full_path() should fix the issue: django/contrib/admin/sites.py diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index 61be31d890..96c54e44ad 100644 a b class AdminSite: 453453 pass 454454 else: 455455 if getattr(match.func, "should_append_slash", True): 456 re...
2023-03-02T19:06:12Z
5
["test_missing_slash_append_slash_true_query_string (admin_views.tests.AdminSiteFinalCatchAllPatternTests.test_missing_slash_append_slash_true_query_string)", "test_missing_slash_append_slash_true_script_name_query_string (admin_views.tests.AdminSiteFinalCatchAllPatternTests.test_missing_slash_append_slash_true_script_...
["\"", "#13749 - Admin should display link to front-end site 'View site'", "#21056 -- URL reversing shouldn't work for nonexistent apps.", "#8408 -- \"Show all\" should be displayed instead of the total count if", "'Save as new' should raise PermissionDenied for users without the 'add'", "'View on site should' work pro...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16631
9b224579875e30203d079cc2fee83b116d98eb78
diff --git a/django/contrib/auth/__init__.py b/django/contrib/auth/__init__.py --- a/django/contrib/auth/__init__.py +++ b/django/contrib/auth/__init__.py @@ -199,12 +199,26 @@ def get_user(request): # Verify the session if hasattr(user, "get_session_auth_hash"): session_hash ...
diff --git a/tests/auth_tests/test_basic.py b/tests/auth_tests/test_basic.py --- a/tests/auth_tests/test_basic.py +++ b/tests/auth_tests/test_basic.py @@ -1,3 +1,4 @@ +from django.conf import settings from django.contrib.auth import get_user, get_user_model from django.contrib.auth.models import AnonymousUser, User ...
SECRET_KEY_FALLBACKS is not used for sessions Description I recently rotated my secret key, made the old one available in SECRET_KEY_FALLBACKS and I'm pretty sure everyone on our site is logged out now. I think the docs for ​SECRET_KEY_FALLBACKS may be incorrect when stating the following: In order to rotate your sec...
Hi! I'm a colleague of Eric's, and we were discussing some of the ramifications of fixing this issue and I thought I'd write them here for posterity. In particular for user sessions, using fallback keys in the AuthenticationMiddleware/auth.get_user(request) will keep existing _auth_user_hash values from before the rota...
2023-03-06T15:19:52Z
5
["test_get_user_fallback_secret (auth_tests.test_basic.TestGetUser.test_get_user_fallback_secret)"]
["Check the creation and properties of a superuser", "Default User model verbose names are translatable (#19945)", "The alternate user setting must point to something in the format app.model", "The current user model can be retrieved", "The current user model can be swapped out for another", "The current user model mus...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16649
39d1e45227e060746ed461fddde80fa2b6cf0dcd
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 @@ -1087,7 +1087,12 @@ def add_annotation(self, annotation, alias, select=True): if select: self.append_annotation_mask([alias]) else: - ...
diff --git a/tests/postgres_tests/test_array.py b/tests/postgres_tests/test_array.py --- a/tests/postgres_tests/test_array.py +++ b/tests/postgres_tests/test_array.py @@ -466,8 +466,8 @@ def test_group_by_order_by_select_index(self): ], ) sql = ctx[0]["sql"] - self.assertIn...
Querysets: annotate() columns are forced into a certain position which may disrupt union() Description (Reporting possible issue found by a user on #django) Using values() to force selection of certain columns in a certain order proved useful unioning querysets with union() for the aforementioned user. The positionin...
(The ticket component should change to "Documentation" if there aren't any code changes to make here. I'm not sure.) Probably duplicate of #28900. I've stumbled upon a case in production where this limitation prevents me for making a useful query. I've been able to create a test to reproduce this problem. It works with...
2023-03-13T14:06:31Z
5
["test_union_multiple_models_with_values_list_and_annotations (queries.test_qs_combinators.QuerySetSetOperationTests.test_union_multiple_models_with_values_list_and_annotations)", "test_union_with_two_annotated_values_list (queries.test_qs_combinators.QuerySetSetOperationTests.test_union_with_two_annotated_values_list)...
["test_combining_multiple_models (queries.test_qs_combinators.QuerySetSetOperationTests.test_combining_multiple_models)", "test_count_difference (queries.test_qs_combinators.QuerySetSetOperationTests.test_count_difference)", "test_count_intersection (queries.test_qs_combinators.QuerySetSetOperationTests.test_count_inte...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16735
2eb1f37260f0e0b71ef3a77eb5522d2bb68d6489
diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py --- a/django/urls/resolvers.py +++ b/django/urls/resolvers.py @@ -23,7 +23,7 @@ from django.utils.functional import cached_property from django.utils.http import RFC3986_SUBDELIMS, escape_leading_slashes from django.utils.regex_helper import _lazy_re_c...
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -1916,6 +1916,12 @@ def test_default_lang_without_prefix(self): response = self.client.get("/simple/") self.assertEqual(response.content, b"Yes") + @override_settings(LANGUAGE_CODE="en-us...
i18n_patterns() not respecting prefix_default_language=False Description (last modified by Oussama Jarrousse) In my django project urls.py file I have the following setup: from django.conf.urls.i18n import i18n_patterns from django.contrib import admin from django.urls import include from django.urls import pat...
Thanks for the ticket, however I'm not able to reproduce this issue. Can you provide a small sample project that reproduces this? (it seems to be related with 94e7f471c4edef845a4fe5e3160132997b4cca81.) I will provide the project shortly on github... In the meanwhile, I assume you were not able to reproduce the issue be...
2023-04-06T17:43:04Z
5
["test_default_lang_fallback_without_prefix (i18n.tests.UnprefixedDefaultLanguageTests.test_default_lang_fallback_without_prefix)"]
["\"loading_app\" does not have translations for all languages provided by", "'Accept-Language' is respected.", "A language set in the cookies is respected.", "A request for a nonexistent URL shouldn't cause a redirect to", "A string representation is returned for unlocalized numbers.", "After setting LANGUAGE, the cac...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16745
549d6ffeb6d626b023acc40c3bb2093b4b25b3d6
diff --git a/django/core/validators.py b/django/core/validators.py --- a/django/core/validators.py +++ b/django/core/validators.py @@ -397,8 +397,37 @@ class StepValueValidator(BaseValidator): message = _("Ensure this value is a multiple of step size %(limit_value)s.") code = "step_size" + def __init__(s...
diff --git a/tests/forms_tests/field_tests/test_decimalfield.py b/tests/forms_tests/field_tests/test_decimalfield.py --- a/tests/forms_tests/field_tests/test_decimalfield.py +++ b/tests/forms_tests/field_tests/test_decimalfield.py @@ -152,6 +152,25 @@ def test_decimalfield_6(self): with self.assertRaisesMessag...
StepValueValidator does not take into account min_value Description If you define a number input with <input type="number" min=1 step=2>, client side this will only allow positive odd numbers. We could generate the same input in a Django form with IntegerField(min_value=1, step_size=2) and Field.localize is False, w...
Thanks for the report! As far as I'm aware we should pass min_value to the StepValueValidator. Bug in 3a82b5f655446f0ca89e3b6a92b100aa458f348f. Thanks for the report. I think this is a bug. We need to consider min value also with step_size
2023-04-09T09:19:48Z
5
["A localized DecimalField's widget renders to a text input without", "A localized FloatField's widget renders to a text input without any", "A localized IntegerField's widget renders to a text input without any", "Class-defined widget is not overwritten by __init__() (#22245).", "test_basic_equality (validators.tests....
[]
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16749
c3d7a71f836f7cfe8fa90dd9ae95b37b660d5aae
diff --git a/django/core/handlers/asgi.py b/django/core/handlers/asgi.py --- a/django/core/handlers/asgi.py +++ b/django/core/handlers/asgi.py @@ -26,6 +26,15 @@ logger = logging.getLogger("django.request") +def get_script_prefix(scope): + """ + Return the script prefix to use from either the scope or a sett...
diff --git a/tests/handlers/tests.py b/tests/handlers/tests.py --- a/tests/handlers/tests.py +++ b/tests/handlers/tests.py @@ -3,6 +3,7 @@ from django.core.signals import request_finished, request_started from django.db import close_old_connections, connection from django.test import ( + AsyncRequestFactory, ...
ASGIRequest doesn't respect settings.FORCE_SCRIPT_NAME. Description For example, I have settings.FORCE_SCRIPT_NAME = '/some-prefix' I start a django server with command: daphne django_project.asgi:application And I navigate to the ​http://localhost:8000/admin/login, and see the login form action url is "/admin/login"...
Thanks for the report. It seems that ASGIRequest should take FORCE_SCRIPT_NAME into account (as WSGIRequest), e.g. django/core/handlers/asgi.py diff --git a/django/core/handlers/asgi.py b/django/core/handlers/asgi.py index 569157b277..c5eb87c712 100644 a b class ASGIRequest(HttpRequest): 4040 self._post_parse_error = F...
2023-04-10T15:14:46Z
5
["test_force_script_name (handlers.tests.AsyncHandlerRequestTests.test_force_script_name)"]
["A non-UTF-8 path populates PATH_INFO with an URL-encoded path and", "Calling a sync view down the asynchronous path.", "Calling an async view down the asynchronous path.", "Calling an async view down the normal synchronous path.", "Invalid boundary string should produce a \"Bad Request\" response, not a", "Invalid co...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16757
83c9765f45e4622e4a5af3adcd92263a28b13624
diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py --- a/django/contrib/admin/checks.py +++ b/django/contrib/admin/checks.py @@ -916,10 +916,13 @@ def _check_list_display_item(self, obj, item, label): id="admin.E108", ) ] - ...
diff --git a/tests/modeladmin/test_checks.py b/tests/modeladmin/test_checks.py --- a/tests/modeladmin/test_checks.py +++ b/tests/modeladmin/test_checks.py @@ -537,7 +537,20 @@ class TestModelAdmin(ModelAdmin): self.assertIsInvalid( TestModelAdmin, ValidationTestModel, - "Th...
Admin check for reversed foreign key used in "list_display" Description Currently the admin site checks and reports an admin.E109 system check error when a ManyToManyField is declared within the list_display values. But, when a reversed foreign key is used there is no system error reported: System check identified no...
Thanks for the report.
2023-04-12T15:09:26Z
5
["test_invalid_field_type (modeladmin.test_checks.ListDisplayTests.test_invalid_field_type)", "test_invalid_reverse_related_field (modeladmin.test_checks.ListDisplayTests.test_invalid_reverse_related_field)"]
["The first item in list_display can be in list_editable as long as", "The first item in list_display can be the same as the first in", "The first item in list_display cannot be in list_editable if", "The first item in list_display cannot be the same as the first item", "list_display and list_editable can contain the s...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16810
191f6a9a4586b5e5f79f4f42f190e7ad4bbacc84
diff --git a/django/middleware/locale.py b/django/middleware/locale.py --- a/django/middleware/locale.py +++ b/django/middleware/locale.py @@ -16,37 +16,28 @@ class LocaleMiddleware(MiddlewareMixin): response_redirect_class = HttpResponseRedirect - def get_fallback_language(self, request): - """ - ...
diff --git a/tests/i18n/patterns/tests.py b/tests/i18n/patterns/tests.py --- a/tests/i18n/patterns/tests.py +++ b/tests/i18n/patterns/tests.py @@ -431,6 +431,27 @@ def test_nl_path(self): self.assertEqual(response.context["LANGUAGE_CODE"], "nl") +@override_settings(ROOT_URLCONF="i18n.urls_default_unprefixe...
Translatable URL patterns raise 404 for non-English default language when prefix_default_language=False is used. Description A simple django project with instruction to replicate the bug can be found here: ​github repo In brief: prefix_default_language = False raises HTTP 404 for the default unprefixed pages if LANGU...
Expected behavior: ​django 4.2 documentation LocaleMiddleware tries to determine the user’s language preference by following this algorithm: First, it looks for the language prefix in the requested URL. This is only performed when you are using the i18n_patterns function in your root URLconf. See Internationalization: ...
2023-04-28T06:55:00Z
5
["test_get_language_from_request_null (i18n.tests.CountrySpecificLanguageTests.test_get_language_from_request_null)", "test_translated_path_unprefixed_language_other_than_accepted_header (i18n.patterns.tests.URLPrefixedFalseTranslatedTests.test_translated_path_unprefixed_language_other_than_accepted_header)", "test_tra...
["\"loading_app\" does not have translations for all languages provided by", "A request for a nonexistent URL shouldn't cause a redirect to", "A string representation is returned for unlocalized numbers.", "After setting LANGUAGE, the cache should be cleared and languages", "Check if sublocales fall back to the main lo...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16816
191f6a9a4586b5e5f79f4f42f190e7ad4bbacc84
diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py --- a/django/contrib/admin/checks.py +++ b/django/contrib/admin/checks.py @@ -916,9 +916,10 @@ def _check_list_display_item(self, obj, item, label): id="admin.E108", ) ] - i...
diff --git a/tests/modeladmin/test_checks.py b/tests/modeladmin/test_checks.py --- a/tests/modeladmin/test_checks.py +++ b/tests/modeladmin/test_checks.py @@ -554,6 +554,30 @@ class TestModelAdmin(ModelAdmin): "admin.E109", ) + def test_invalid_related_field(self): + class TestModelAdm...
Error E108 does not cover some cases Description (last modified by Baha Sdtbekov) I have two models, Question and Choice. And if I write list_display = ["choice"] in QuestionAdmin, I get no errors. But when I visit /admin/polls/question/, the following trace is returned: Internal Server Error: /admin/polls/ques...
I think I will make a bug fix later if required Thanks bakdolot 👍 There's a slight difference between a model instance's attributes and the model class' meta's fields. Meta stores the reverse relationship as choice, where as this would be setup & named according to whatever the related_name is declared as. fyi potenti...
2023-04-30T15:37:43Z
5
["test_invalid_m2m_related_name (modeladmin.test_checks.ListDisplayTests.test_invalid_m2m_related_name)", "test_invalid_related_field (modeladmin.test_checks.ListDisplayTests.test_invalid_related_field)"]
["The first item in list_display can be in list_editable as long as", "The first item in list_display can be the same as the first in", "The first item in list_display cannot be in list_editable if", "The first item in list_display cannot be the same as the first item", "list_display and list_editable can contain the s...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16820
c61219a7ae051d2baab53f041e00592011fc550c
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 @@ -303,6 +303,71 @@ def reduce(self, operation, app_label): managers=self.managers, ...
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 @@ -2266,10 +2266,9 @@ def test_same_app_circular_fk_dependency_with_unique_together_and_indexes(self): changes, "e...
Squashing migrations with Meta.index_together -> indexes transition should remove deprecation warnings. Description Squashing migrations with Meta.index_together -> Meta.indexes transition should remove deprecation warnings. As far as I'm aware, it's a 4.2 release blocker because you cannot get rid of the index_toget...
null
2023-05-02T06:32:13Z
5
["#22275 - A migration with circular FK dependency does not try", "Test creation of new model with indexes already defined.", "test_add_model_order_with_respect_to_index (migrations.test_autodetector.AutodetectorTests.test_add_model_order_with_respect_to_index)", "test_create_model_add_index (migrations.test_optimizer....
["#22030 - Adding a field with a default should work.", "#22300 - Adding an FK in the same \"spot\" as a deleted CharField should", "#22435 - Adding a ManyToManyField should not prompt for a default.", "#22951 -- Uninstantiated classes with deconstruct are correctly returned", "#23100 - ForeignKeys correctly depend on ...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16910
4142739af1cda53581af4169dbe16d6cd5e26948
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 @@ -779,7 +779,13 @@ def _get_only_select_mask(self, opts, mask, select_mask=None): # Only include fields mentioned in the mask. for field_name, field_mask...
diff --git a/tests/defer_regress/tests.py b/tests/defer_regress/tests.py --- a/tests/defer_regress/tests.py +++ b/tests/defer_regress/tests.py @@ -178,6 +178,16 @@ def test_reverse_one_to_one_relations(self): self.assertEqual(i.one_to_one_item.name, "second") with self.assertNumQueries(1): ...
QuerySet.only() doesn't work with select_related() on a reverse OneToOneField relation. Description On Django 4.2 calling only() with select_related() on a query using the reverse lookup for a OneToOne relation does not generate the correct query. All the fields from the related model are still included in the genera...
Thanks for the report! Regression in b3db6c8dcb5145f7d45eff517bcd96460475c879. Reproduced at 881cc139e2d53cc1d3ccea7f38faa960f9e56597.
2023-05-31T22:28:10Z
5
["test_inheritance_deferred2 (select_related_onetoone.tests.ReverseSelectRelatedTestCase.test_inheritance_deferred2)", "test_reverse_one_to_one_relations (defer_regress.tests.DeferRegressionTest.test_reverse_one_to_one_relations)"]
["Ticket #13839: select_related() should NOT cache None", "test_back_and_forward (select_related_onetoone.tests.ReverseSelectRelatedTestCase.test_back_and_forward)", "test_basic (defer_regress.tests.DeferRegressionTest.test_basic)", "test_basic (select_related_onetoone.tests.ReverseSelectRelatedTestCase.test_basic)", "...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-16983
ddb6506618ea52c6b20e97eefad03ed847a1e3de
diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py --- a/django/contrib/admin/checks.py +++ b/django/contrib/admin/checks.py @@ -533,6 +533,16 @@ def _check_filter_item(self, obj, field_name, label): return must_be( "a many-to-many field", option=label, ob...
diff --git a/tests/modeladmin/test_checks.py b/tests/modeladmin/test_checks.py --- a/tests/modeladmin/test_checks.py +++ b/tests/modeladmin/test_checks.py @@ -4,10 +4,11 @@ from django.contrib.admin.options import VERTICAL, ModelAdmin, TabularInline from django.contrib.admin.sites import AdminSite from django.core.c...
Add system check for filter_horizontal/filter_vertical on ManyToManyFields with intermediary models. Description Hi team, I'm a huge fan of Django and have been using it since 0.95 but I stumbled over this one. Neither of ​https://docs.djangoproject.com/en/4.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.filter...
Neither of ​https://docs.djangoproject.com/en/4.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.filter_horizontal and ​https://docs.djangoproject.com/en/4.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.filter_vertical call out the requirement to not use ManyToManyField(through="") There is a separate section...
2023-06-16T13:38:28Z
5
["test_invalid_m2m_field_with_through (modeladmin.test_checks.FilterHorizontalCheckTests.test_invalid_m2m_field_with_through)", "test_invalid_m2m_field_with_through (modeladmin.test_checks.FilterVerticalCheckTests.test_invalid_m2m_field_with_through)"]
["The first item in list_display can be in list_editable as long as", "The first item in list_display can be the same as the first in", "The first item in list_display cannot be in list_editable if", "The first item in list_display cannot be the same as the first item", "list_display and list_editable can contain the s...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-17046
95cdf9dc6627135f3893095892816eb3f2785e2e
diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py --- a/django/contrib/admin/views/main.py +++ b/django/contrib/admin/views/main.py @@ -29,7 +29,7 @@ SuspiciousOperation, ) from django.core.paginator import InvalidPage -from django.db.models import Exists, F, Field, ManyToOneRe...
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 @@ -467,7 +467,7 @@ def test_custom_paginator(self): cl.get_results(request) self.assertIsInstance(cl.paginator, CustomPaginator) - def test_n...
Deleting objects after searching related many to many field crashes the admin page Description Minimal reproduction: # models.py class Post(models.Model): title = models.String(...) authors = models.ManyToMany("User", ...) class User(models.Model): email = models.String(...) # admin.py class PostAdmin(admin.ModelA...
This exception was introduce in 6307c3f1a123f5975c73b231e8ac4f115fd72c0d and revealed a possible data loss issue in the admin. IMO we should use Exists() instead of distinct(), e.g. diff --git a/django/contrib/admin/views/main.py b/django/contrib/admin/views/main.py index fefed29933..e9816ddd15 100644 --- a/django/cont...
2023-07-04T21:49:35Z
5
["If a ManyToManyField is in list_filter but isn't in any lookup params,", "test_disallowed_delete_distinct_on (delete_regress.tests.DeleteDistinct.test_disallowed_delete_distinct_on)"]
["#15185 -- Allow no links from the 'change list' view grid.", "All rows containing each of the searched words are returned, where each", "Auto-created many-to-many through tables referencing a parent model are", "Cascade deletion works with ForeignKey.to_field set to non-PK.", "Deleting a proxy-of-proxy instance shoul...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-17051
b7a17b0ea0a2061bae752a3a2292007d41825814
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 @@ -1837,12 +1837,17 @@ def _batched_insert( inserted_rows = [] bulk_return = connection.features.can_return_rows_from_bulk_insert for item in [objs[i : i + batch...
diff --git a/tests/bulk_create/tests.py b/tests/bulk_create/tests.py --- a/tests/bulk_create/tests.py +++ b/tests/bulk_create/tests.py @@ -582,12 +582,16 @@ def _test_update_conflicts_two_fields(self, unique_fields): TwoFields(f1=1, f2=1, name="c"), TwoFields(f1=2, f2=2, name="d"), ] ...
Allow returning IDs in QuerySet.bulk_create() when updating conflicts. Description Currently, when using bulk_create with a conflict handling flag turned on (e.g. ignore_conflicts or update_conflicts), the primary keys are not set in the returned queryset, as documented in bulk_create. While I understand using ignore...
Thanks for the ticket. I've checked and it works on PostgreSQL, MariaDB 10.5+, and SQLite 3.35+: django/db/models/query.py diff --git a/django/db/models/query.py b/django/db/models/query.py index a5b0f464a9..f1e052cb36 100644 a b class QuerySet(AltersData): 18371837 inserted_rows = [] 18381838 bulk_return = connection....
2023-07-07T11:01:09Z
5
["test_update_conflicts_two_fields_unique_fields_first (bulk_create.tests.BulkCreateTests.test_update_conflicts_two_fields_unique_fields_first)", "test_update_conflicts_two_fields_unique_fields_second (bulk_create.tests.BulkCreateTests.test_update_conflicts_two_fields_unique_fields_second)", "test_update_conflicts_uniq...
["Inserting non-ASCII values with a length in the range 2001 to 4000", "Test inserting a large batch with objects having primary key set", "test_batch_same_vals (bulk_create.tests.BulkCreateTests.test_batch_same_vals)", "test_bulk_insert_expressions (bulk_create.tests.BulkCreateTests.test_bulk_insert_expressions)", "te...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-17087
4a72da71001f154ea60906a2f74898d32b7322a7
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 @@ -168,7 +168,7 @@ def serialize(self): ): klass = self.value.__self__ module = klass.__module__ - return ...
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 @@ -211,6 +211,10 @@ class NestedChoices(models.TextChoices): X = "X", "X value" Y = "Y", "Y value" + @classmethod + def method(cls...
Class methods from nested classes cannot be used as Field.default. Description (last modified by Mariusz Felisiak) Given the following model: class Profile(models.Model): class Capability(models.TextChoices): BASIC = ("BASIC", "Basic") PROFESSIONAL = ("PROFESSIONAL", "Professional") @classmethod d...
Thanks for the report. It seems that FunctionTypeSerializer should use __qualname__ instead of __name__: django/db/migrations/serializer.py diff --git a/django/db/migrations/serializer.py b/django/db/migrations/serializer.py index d88cda6e20..06657ebaab 100644 a b class FunctionTypeSerializer(BaseSerializer): 168168 ):...
2023-07-17T20:28:41Z
5
["test_serialize_nested_class_method (migrations.test_writer.WriterTests.test_serialize_nested_class_method)"]
["#24155 - Tests ordering of imports.", "A reference in a local scope can't be serialized.", "An unbound method used within a class body can be serialized.", "Make sure compiled regex can be serialized.", "Test comments at top of file.", "Tests serializing a simple migration.", "Ticket #22679: makemigrations generates ...
4a72da71001f154ea60906a2f74898d32b7322a7
django/django
django__django-5470
9dcfecb7c6c8285630ad271888a9ec4ba9140e3a
diff --git a/django/__init__.py b/django/__init__.py --- a/django/__init__.py +++ b/django/__init__.py @@ -1,3 +1,5 @@ +from __future__ import unicode_literals + from django.utils.version import get_version VERSION = (1, 10, 0, 'alpha', 0) @@ -5,14 +7,21 @@ __version__ = get_version(VERSION) -def setup(): +def...
diff --git a/tests/user_commands/management/commands/reverse_url.py b/tests/user_commands/management/commands/reverse_url.py new file mode 100644 --- /dev/null +++ b/tests/user_commands/management/commands/reverse_url.py @@ -0,0 +1,10 @@ +from django.core.management.base import BaseCommand +from django.core.urlresolver...
Set script prefix in django.setup() to allow its usage outside of requests Description The script prefix for django.core.urlresolvers doesn't get set to anything when being called through manage.py, because of course it doesn't know what that value should be. This is a problem if you're rendering views (or otherwise ...
Based on code inspection, I confirm that this bug exists. Possible fix: django.core.management.setup_environ could do something along the lines of: from django.conf import settings from django.core.management.base import set_script_prefix from django.utils.encoding import force_unicode set_script_prefix(u'/' if setting...
2015-10-23T19:21:03Z
1.1
["test_script_prefix_set_in_commands (user_commands.tests.CommandRunTests)"]
["Exception raised in a command should raise CommandError with", "Test that an unknown command raises CommandError", "test_call_command_no_checks (user_commands.tests.CommandTests)", "test_call_command_option_parsing (user_commands.tests.CommandTests)", "test_call_command_option_parsing_non_string_arg (user_commands.te...
4074fa91452006890a878f0b6a1a25251461cf26
django/django
django__django-7530
f8fab6f90233c7114d642dfe01a4e6d4cb14ee7d
diff --git a/django/core/management/commands/makemigrations.py b/django/core/management/commands/makemigrations.py --- a/django/core/management/commands/makemigrations.py +++ b/django/core/management/commands/makemigrations.py @@ -105,7 +105,7 @@ def handle(self, *app_labels, **options): # At least...
diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py --- a/tests/migrations/test_commands.py +++ b/tests/migrations/test_commands.py @@ -598,6 +598,7 @@ def test_makemigrations_empty_connections(self): init_file = os.path.join(migration_dir, '__init__.py') ...
makemigrations router.allow_migrate() calls for consistency checks use incorrect (app_label, model) pairs Description As reported in ticket:27200#comment:14, I makemigrations incorrectly calls allow_migrate() for each app with all the models in the project rather than for each app with the app's models. It broke the ...
null
2016-11-08T17:27:19Z
1.11
["test_squashmigrations_initial_attribute (migrations.test_commands.SquashMigrationsTests)"]
["test_failing_migration (migrations.test_commands.MakeMigrationsTests)", "test_files_content (migrations.test_commands.MakeMigrationsTests)", "test_makemigration_merge_dry_run (migrations.test_commands.MakeMigrationsTests)", "test_makemigration_merge_dry_run_verbosity_3 (migrations.test_commands.MakeMigrationsTests)",...
3545e844885608932a692d952c12cd863e2320b5
django/django
django__django-8630
59841170ba1785ada10a2915b0b60efdb046ee39
diff --git a/django/contrib/auth/views.py b/django/contrib/auth/views.py --- a/django/contrib/auth/views.py +++ b/django/contrib/auth/views.py @@ -43,6 +43,7 @@ class LoginView(SuccessURLAllowedHostsMixin, FormView): """ form_class = AuthenticationForm authentication_form = None + next_page = None ...
diff --git a/tests/auth_tests/test_views.py b/tests/auth_tests/test_views.py --- a/tests/auth_tests/test_views.py +++ b/tests/auth_tests/test_views.py @@ -52,8 +52,8 @@ def setUpTestData(cls): cls.u1 = User.objects.create_user(username='testclient', password='password', email='testclient@example.com') ...
Add next_page to LoginView Description LogoutView has a next_page attribute used to override settings.LOGOUT_REDIRECT_URL. It would be nice if LoginView had the same mechanism.
Did you consider overriding the get_success_url() method? Perhaps that method could be documented. Also there is settings.LOGIN_REDIRECT_URL. Do you have a use case that requires customizing the redirect for different login views? Yes I have, the issue with that is when redirect_authenticated_user = True, dispatch also...
2017-06-11T15:40:06Z
4
["#21649 - Ensure contrib.auth.views.password_change updates the user's", "A POST with an invalid token is rejected.", "A multipart email with text/plain and text/html is sent", "A uidb64 that decodes to a non-UUID doesn't crash.", "As above, but same user logging in after a password change.", "Detect a redirect loop i...
[]
475cffd1d64c690cdad16ede4d5e81985738ceb4
django/django
django__django-9296
84322a29ce9b0940335f8ab3d60e55192bef1e50
diff --git a/django/core/paginator.py b/django/core/paginator.py --- a/django/core/paginator.py +++ b/django/core/paginator.py @@ -34,6 +34,10 @@ def __init__(self, object_list, per_page, orphans=0, self.orphans = int(orphans) self.allow_empty_first_page = allow_empty_first_page + def __iter__(se...
diff --git a/tests/pagination/tests.py b/tests/pagination/tests.py --- a/tests/pagination/tests.py +++ b/tests/pagination/tests.py @@ -297,6 +297,13 @@ def test_get_page_empty_object_list_and_allow_empty_first_page_false(self): with self.assertRaises(EmptyPage): paginator.get_page(1) + def te...
Paginator just implement the __iter__ function Description (last modified by Alex Gaynor) Right now, when you want to iter into all the pages of a Paginator object you to use the page_range function. It would be more logical and naturel to use the normal python of doing that by implementing the iter function li...
Reformatted, please use the preview button in the future. I'm not sure that's common enough functionality to worry about. So, some 9 years later we have a ​PR with this exact suggestion implemented... I'm going to reopen and Accept. Seems reasonable enough, and it's a small addition to enable a kind-of-expected behavio...
2017-10-27T11:10:04Z
3.1
["test_paginator_iteration (pagination.tests.PaginationTests)"]
["Paginator.get_page() with an empty object_list.", "test_count_does_not_silence_attribute_error (pagination.tests.PaginationTests)", "test_count_does_not_silence_type_error (pagination.tests.PaginationTests)", "test_first_page (pagination.tests.ModelPaginationTests)", "test_float_integer_page (pagination.tests.Paginat...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-9871
2919a08c20d5ae48e381d6bd251d3b0d400d47d9
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 @@ -228,6 +228,9 @@ def create_parser(self, prog_name, subcommand): self, prog="%s %s" % (os.path.basename(prog_name), subcommand), description...
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -1495,6 +1495,13 @@ def test_specific_help(self): args = ['check', '--help'] out, err = self.run_manage(args) self.assertNoOutput(err) + # C...
Reorder management command arguments in --help output to prioritize command-specific arguments Description Currently if you run a custom management command with --help, you will get output that looks like: I have highlighted in yellow the useful information specific to the command that is *not* boilerplate. Notice th...
null
2018-04-11T02:53:17Z
2.1
["--help can be used on a specific command"]
["\"", "--help is equivalent to help", "--no-color prevent colorization of the output", "--output=unified emits settings diff in unified mode.", "--version is equivalent to version", "-h is handled as a short form of --help", "All errors/warnings should be sorted by level and by message.", "Make sure passing the wrong ...
3574a6d32fcd88d404b110a8d2204db1dd14a545
matplotlib/matplotlib
matplotlib__matplotlib-14471
ddb891751d797517e28b9f74d1fffc98716f8c7d
diff --git a/lib/matplotlib/__init__.py b/lib/matplotlib/__init__.py --- a/lib/matplotlib/__init__.py +++ b/lib/matplotlib/__init__.py @@ -1105,6 +1105,10 @@ def use(backend, *, force=True): """ Select the backend used for rendering and GUI integration. + If pyplot is already imported, `~matplotlib.pyplo...
diff --git a/lib/matplotlib/tests/test_pyplot.py b/lib/matplotlib/tests/test_pyplot.py --- a/lib/matplotlib/tests/test_pyplot.py +++ b/lib/matplotlib/tests/test_pyplot.py @@ -398,3 +398,14 @@ def test_minor_ticks(): tick_labels = ax.get_yticklabels(minor=True) assert np.all(tick_pos == np.array([3.5, 6.5])) ...
Existing FigureCanvasQT objects destroyed by call to plt.figure ### Bug report **Bug summary** For a number of years, I have been maintaining an interactive application that embeds subclassed FigureCanvasQT objects within a PyQt application. Up until Matplotlib v3.0.3., it was possible to create standard Matplotlib P...
This bisects to #12637, and is essentially due to the fact that we now initialize ipython/matplotlib support when the first canvas is created (here, by `plt.figure()`), that during initialization, ipython calls `switch_backend`, that `switch_backend` starts by calling `close("all")`, and that NXPlotView() is registered...
2019-06-06T22:15:33Z
3.1
["lib/matplotlib/tests/test_pyplot.py::test_switch_backend_no_close"]
["lib/matplotlib/tests/test_pyplot.py::test_axes_kwargs", "lib/matplotlib/tests/test_pyplot.py::test_close", "lib/matplotlib/tests/test_pyplot.py::test_copy_docstring_and_deprecators", "lib/matplotlib/tests/test_pyplot.py::test_doc_pyplot_summary", "lib/matplotlib/tests/test_pyplot.py::test_fallback_position", "lib/mat...
42259bb9715bbacbbb2abc8005df836f3a7fd080
matplotlib/matplotlib
matplotlib__matplotlib-19743
5793ebb2201bf778f08ac1d4cd0b8dd674c96053
diff --git a/examples/text_labels_and_annotations/figlegend_demo.py b/examples/text_labels_and_annotations/figlegend_demo.py --- a/examples/text_labels_and_annotations/figlegend_demo.py +++ b/examples/text_labels_and_annotations/figlegend_demo.py @@ -28,3 +28,26 @@ plt.tight_layout() plt.show() + +#################...
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 @@ -4,6 +4,7 @@ import warnings import numpy as np +from numpy.testing import assert_allclose import pytest from matplotlib.testing.decorator...
constrained_layout support for figure.legend Just a feature request to have constrained_layout support `figure.legend`
What behaviour would you expect? If you want the legend to steal space on the figure from the axes, then call `axes.legend` with the correct handles and it will make room. Yes. Here's an example from seaborn. I would expect this to be the result of `figure.legend(handles, labels, loc='right')` ![image](https://us...
2021-03-19T05:13:17Z
3.3
["lib/matplotlib/tests/test_legend.py::test_figure_legend_outside"]
["lib/matplotlib/tests/test_legend.py::TestLegendFigureFunction::test_legend_handle_label", "lib/matplotlib/tests/test_legend.py::TestLegendFigureFunction::test_legend_kw_args", "lib/matplotlib/tests/test_legend.py::TestLegendFigureFunction::test_legend_label_arg", "lib/matplotlib/tests/test_legend.py::TestLegendFigure...
28289122be81e0bc0a6ee0c4c5b7343a46ce2e4e
matplotlib/matplotlib
matplotlib__matplotlib-20470
f0632c0fc7339f68e992ed63ae4cfac76cd41aad
diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -38,6 +38,7 @@ from matplotlib.collections import ( Collection, CircleCollection, LineCollection, PathCollection, PolyCollection, RegularPolyCollection) +from matplotlib.text impo...
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 @@ -493,6 +493,15 @@ def test_handler_numpoints(): ax.legend(numpoints=0.5) +def test_text_nohandler_warning(): + """Test that Text artis...
Handle and label not created for Text with label ### Bug report **Bug summary** Text accepts a `label` keyword argument but neither its handle nor its label is created and added to the legend. **Code for reproduction** ```python import matplotlib.pyplot as plt x = [0, 10] y = [0, 10] fig = plt.figure() ax = fig.a...
This is an imprecision in the API. Technically, every `Artist` can have a label. But note every `Artist` has a legend handler (which creates the handle to show in the legend, see also https://matplotlib.org/3.3.3/api/legend_handler_api.html#module-matplotlib.legend_handler). In particular `Text` does not have a legend...
2021-06-19T22:21:18Z
3.4
["lib/matplotlib/tests/test_legend.py::test_text_nohandler_warning"]
["lib/matplotlib/tests/test_legend.py::TestLegendFigureFunction::test_legend_handle_label", "lib/matplotlib/tests/test_legend.py::TestLegendFigureFunction::test_legend_kw_args", "lib/matplotlib/tests/test_legend.py::TestLegendFigureFunction::test_legend_label_arg", "lib/matplotlib/tests/test_legend.py::TestLegendFigure...
f93c0a3dcb82feed0262d758626c90d4002685f3
matplotlib/matplotlib
matplotlib__matplotlib-20584
06141dab06373d0cb2806b3aa87ca621fbf5c426
diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -1461,7 +1461,14 @@ def get_segments(self): segments = [] for path in self._paths: - vertices = [vertex for vertex, _ in path.iter_segments...
diff --git a/lib/matplotlib/tests/test_collections.py b/lib/matplotlib/tests/test_collections.py --- a/lib/matplotlib/tests/test_collections.py +++ b/lib/matplotlib/tests/test_collections.py @@ -1039,3 +1039,12 @@ def test_quadmesh_cursor_data(): x, y = ax.transData.transform([-1, 101]) event = MouseE...
set_segments(get_segments()) makes lines coarse After plotting with `contourf`, I would like to retrieve the lines and manipulate them. Unfortunately, I noticed that the result is much coarser than without manipulation. In fact, a simple `lc.set_segments(lc.get_segments())` has this effect. I would have expected this d...
Aha: There is ``` c.allsegs ``` which can be manipulated instead. Hi @nschloe, has your problem been resolved? Interesting between 3.4.2 and the default branch this has changed from a `LineCollection` to a `PathCollection` which notable does not even _have_ a `get_segments`. `get_segments()` was wrong apparently, so pr...
2021-07-06T19:51:52Z
3.4
["lib/matplotlib/tests/test_collections.py::test_get_segments"]
["lib/matplotlib/tests/test_collections.py::test_EllipseCollection[png]", "lib/matplotlib/tests/test_collections.py::test_EventCollection_nosort", "lib/matplotlib/tests/test_collections.py::test_LineCollection_args", "lib/matplotlib/tests/test_collections.py::test__EventCollection__add_positions[pdf]", "lib/matplotlib/...
f93c0a3dcb82feed0262d758626c90d4002685f3
matplotlib/matplotlib
matplotlib__matplotlib-20676
6786f437df54ca7780a047203cbcfaa1db8dc542
diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -2156,7 +2156,12 @@ def new_axes(self, ax): self.artists.append(self._rect) def _setup_edge_handle(self, props): - self._edge_handles = ToolLineHandles(self.ax...
diff --git a/lib/matplotlib/tests/test_widgets.py b/lib/matplotlib/tests/test_widgets.py --- a/lib/matplotlib/tests/test_widgets.py +++ b/lib/matplotlib/tests/test_widgets.py @@ -302,6 +302,35 @@ def test_tool_line_handle(): assert tool_line_handle.positions == positions +@pytest.mark.parametrize('direction', ...
interactive SpanSelector incorrectly forces axes limits to include 0 <!--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** **Code for reproduction** <!--A minimum cod...
I can't reproduce (or I don't understand what is the issue). Can you confirm that the following gif is the expected behaviour and that you get something different? ![Peek 2021-07-19 08-46](https://user-images.githubusercontent.com/11851990/126122649-236a4125-84c7-4f35-8c95-f85e1e07a19d.gif) The point is that in the g...
2021-07-19T10:10:07Z
3.4
["lib/matplotlib/tests/test_widgets.py::test_span_selector_bound[horizontal]", "lib/matplotlib/tests/test_widgets.py::test_span_selector_bound[vertical]"]
["lib/matplotlib/tests/test_widgets.py::test_CheckButtons", "lib/matplotlib/tests/test_widgets.py::test_MultiCursor[False-True]", "lib/matplotlib/tests/test_widgets.py::test_MultiCursor[True-False]", "lib/matplotlib/tests/test_widgets.py::test_MultiCursor[True-True]", "lib/matplotlib/tests/test_widgets.py::test_TextBox...
f93c0a3dcb82feed0262d758626c90d4002685f3
matplotlib/matplotlib
matplotlib__matplotlib-20761
7413aa92b5be5760c73e31641ab0770f328ad546
diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -370,7 +370,10 @@ def _suplabels(self, t, info, **kwargs): x = kwargs.pop('x', None) y = kwargs.pop('y', None) - autopos = x is None and y is None + if info...
diff --git a/lib/matplotlib/tests/test_constrainedlayout.py b/lib/matplotlib/tests/test_constrainedlayout.py --- a/lib/matplotlib/tests/test_constrainedlayout.py +++ b/lib/matplotlib/tests/test_constrainedlayout.py @@ -537,3 +537,26 @@ def test_align_labels(): after_align[1].x0, rtol=0, ...
[Bug]: subfigure position shifts on y-axis when x kwarg added to supxlabel ### Bug summary Location of subfigure shifts lower on y-axis when 'x' kwarg is used for supxlabel for that subfigure. I've also posted to StackOverflow: https://stackoverflow.com/q/68567315/9249533 ### Code for reproduction ```python fig = pl...
This has nothing to do with subfigures, right? This happens if you specify x or y in supx/ylabel even on a normal figure, I think. Not sure. I've only used suptitles to date. Will do some more digging. Cheers ```python import matplotlib.pyplot as plt fig, ax = plt.subplots(constrained_layout=True) fig.supxlabel...
2021-07-28T22:36:30Z
3.4
["lib/matplotlib/tests/test_constrainedlayout.py::test_suplabels"]
["lib/matplotlib/tests/test_constrainedlayout.py::test_align_labels", "lib/matplotlib/tests/test_constrainedlayout.py::test_bbox[png]", "lib/matplotlib/tests/test_constrainedlayout.py::test_bboxtight[png]", "lib/matplotlib/tests/test_constrainedlayout.py::test_colorbar_align", "lib/matplotlib/tests/test_constrainedlayo...
f93c0a3dcb82feed0262d758626c90d4002685f3
matplotlib/matplotlib
matplotlib__matplotlib-21443
d448de31b7deaec8310caaf8bba787e097bf9211
diff --git a/lib/matplotlib/pyplot.py b/lib/matplotlib/pyplot.py --- a/lib/matplotlib/pyplot.py +++ b/lib/matplotlib/pyplot.py @@ -1059,8 +1059,12 @@ def axes(arg=None, **kwargs): plt.axes((left, bottom, width, height), facecolor='w') """ fig = gcf() + pos = kwargs.pop('position', None) if ar...
diff --git a/lib/matplotlib/tests/test_pyplot.py b/lib/matplotlib/tests/test_pyplot.py --- a/lib/matplotlib/tests/test_pyplot.py +++ b/lib/matplotlib/tests/test_pyplot.py @@ -1,4 +1,5 @@ import difflib +import numpy as np import subprocess import sys from pathlib import Path @@ -320,3 +321,17 @@ def test_polar_seco...
[Bug]: axes(position = [...]) behavior ### Bug summary when setting axes position with `ax = plt.axes(position = [...])` the position data is not being incorporated. ### Code for reproduction ```python import matplotlib.pyplot as plt fig = plt.figure() pos1 = [0.1, 0.1, 0.3, 0.8] pos2 = [0.5, 0.1, 0.4, 0.6] ax1 =...
Tried updating to 3.4.3 and got the same plotting result. ``` The following NEW packages will be INSTALLED: charls pkgs/main/win-64::charls-2.2.0-h6c2663c_0 giflib pkgs/main/win-64::giflib-5.2.1-h62dcd97_0 imagecodecs pkgs/main/win-64::imagecodecs-2021.6.8-py38he57d016_1 lcms2 ...
2021-10-23T18:27:39Z
3.4
["lib/matplotlib/tests/test_pyplot.py::test_fallback_position"]
["lib/matplotlib/tests/test_pyplot.py::test_axes_kwargs", "lib/matplotlib/tests/test_pyplot.py::test_close", "lib/matplotlib/tests/test_pyplot.py::test_copy_docstring_and_deprecators", "lib/matplotlib/tests/test_pyplot.py::test_gca_kwargs", "lib/matplotlib/tests/test_pyplot.py::test_ioff", "lib/matplotlib/tests/test_py...
f93c0a3dcb82feed0262d758626c90d4002685f3
matplotlib/matplotlib
matplotlib__matplotlib-21481
d448de31b7deaec8310caaf8bba787e097bf9211
diff --git a/lib/matplotlib/_layoutgrid.py b/lib/matplotlib/_layoutgrid.py --- a/lib/matplotlib/_layoutgrid.py +++ b/lib/matplotlib/_layoutgrid.py @@ -169,7 +169,8 @@ def hard_constraints(self): self.solver.addConstraint(c | 'required') def add_child(self, child, i=0, j=0): - self.childre...
diff --git a/lib/matplotlib/tests/test_constrainedlayout.py b/lib/matplotlib/tests/test_constrainedlayout.py --- a/lib/matplotlib/tests/test_constrainedlayout.py +++ b/lib/matplotlib/tests/test_constrainedlayout.py @@ -560,3 +560,10 @@ def test_suplabels(): pos = ax.get_tightbbox(fig.canvas.get_renderer()) as...
[Bug]: Subfigure breaks for some `Gridspec` slices when using `constrained_layout` ### Bug summary When creating a figure with `constrained_layout=True` you cannot use arbitrary gridspecs to create subfigures as it throws an error at some point ( I think once the layout manager actually takes effect?). This happened i...
Not 100% sure what is going on, but pretty sure we never tested add_subfigure on arbitrary gridspec slices. Maybe it can be made to work, but you may be stretching the limits of what is possible. For the layout above I'm not sure why you don't just have two columns. But maybe that si just a simple example.
2021-10-28T08:05:46Z
3.4
["lib/matplotlib/tests/test_figure.py::test_subfigure_spanning"]
["lib/matplotlib/tests/test_constrainedlayout.py::test_align_labels", "lib/matplotlib/tests/test_constrainedlayout.py::test_bbox[png]", "lib/matplotlib/tests/test_constrainedlayout.py::test_bboxtight[png]", "lib/matplotlib/tests/test_constrainedlayout.py::test_colorbar_align", "lib/matplotlib/tests/test_constrainedlayo...
f93c0a3dcb82feed0262d758626c90d4002685f3
matplotlib/matplotlib
matplotlib__matplotlib-21490
b09aad279b5dcfc49dcf43e0b064eee664ddaf68
diff --git a/examples/units/basic_units.py b/examples/units/basic_units.py --- a/examples/units/basic_units.py +++ b/examples/units/basic_units.py @@ -132,6 +132,9 @@ def __init__(self, value, unit): self.unit = unit self.proxy_target = self.value + def __copy__(self): + return TaggedValue...
diff --git a/lib/matplotlib/tests/test_lines.py b/lib/matplotlib/tests/test_lines.py --- a/lib/matplotlib/tests/test_lines.py +++ b/lib/matplotlib/tests/test_lines.py @@ -332,3 +332,14 @@ def test_picking(): found, indices = l2.contains(mouse_event) assert found assert_array_equal(indices['ind'], [0]) + ...
[Bug]: Line2D should copy its inputs ### Bug summary Currently, Line2D doesn't copy its inputs if they are already arrays. Most of the time, in-place modifications to the input arrays do *not* affect the draw line, because there is a cache that doesn't get invalidated, but in some circumstances, it *is* possible for ...
I agree, for most practical purposes, the memory consumption should be negligable. If one wanted to be on the safe side, one could add a flag, but I tend to think that's not neccesary. Seems like a well defined what-to-do (with a lot of examples at other places in the code) -- adding it as a good first issue/hacktober...
2021-10-28T22:36:00Z
3.4
["lib/matplotlib/tests/test_lines.py::test_input_copy[pdf]", "lib/matplotlib/tests/test_lines.py::test_input_copy[png]"]
["lib/matplotlib/tests/test_lines.py::test_drawstyle_variants[png]", "lib/matplotlib/tests/test_lines.py::test_invisible_Line_rendering", "lib/matplotlib/tests/test_lines.py::test_line_colors", "lib/matplotlib/tests/test_lines.py::test_line_dashes[pdf]", "lib/matplotlib/tests/test_lines.py::test_line_dashes[png]", "lib...
f93c0a3dcb82feed0262d758626c90d4002685f3
matplotlib/matplotlib
matplotlib__matplotlib-21542
f0632c0fc7339f68e992ed63ae4cfac76cd41aad
diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -352,6 +352,8 @@ class Colorbar: ticks : `~matplotlib.ticker.Locator` or array-like of float format : str or `~matplotlib.ticker.Formatter` + If string, it support...
diff --git a/lib/matplotlib/tests/test_colorbar.py b/lib/matplotlib/tests/test_colorbar.py --- a/lib/matplotlib/tests/test_colorbar.py +++ b/lib/matplotlib/tests/test_colorbar.py @@ -543,14 +543,15 @@ def test_colorbar_renorm(): assert np.isclose(cbar.vmax, z.max() * 1000) -def test_colorbar_format(): +@pytest...
[ENH]: use new style format strings for colorbar ticks ### Problem At the moment, the default format strings in colorbar are old style ones, as in their init there is: https://github.com/matplotlib/matplotlib/blob/67e18148d87db04d2c8d4293ff12c56fbbb7fde8/lib/matplotlib/colorbar.py#L489-L492 which is a different conv...
null
2021-11-04T22:23:30Z
3.4
["lib/matplotlib/tests/test_colorbar.py::test_colorbar_format[{x:.2e}]"]
["lib/matplotlib/tests/test_colorbar.py::test_anchored_cbar_position_using_specgrid", "lib/matplotlib/tests/test_colorbar.py::test_aspects", "lib/matplotlib/tests/test_colorbar.py::test_axes_handles_same_functions[png]", "lib/matplotlib/tests/test_colorbar.py::test_cbar_minorticks_for_rc_xyminortickvisible", "lib/matpl...
f93c0a3dcb82feed0262d758626c90d4002685f3
matplotlib/matplotlib
matplotlib__matplotlib-21550
460073b2d9122e276d42c2775bad858e337a51f1
diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -202,6 +202,18 @@ def __init__(self, if offsets.shape == (2,): offsets = offsets[None, :] self._offsets = offsets + elif...
diff --git a/lib/matplotlib/tests/test_collections.py b/lib/matplotlib/tests/test_collections.py --- a/lib/matplotlib/tests/test_collections.py +++ b/lib/matplotlib/tests/test_collections.py @@ -1072,8 +1072,13 @@ def test_set_offsets_late(): def test_set_offset_transform(): + with pytest.warns(MatplotlibDeprec...
[Bug]: this example shows ok on matplotlib-3.4.3, but not in matplotlib-3.5.0 master of october 30th ### Bug summary the display is not working well if swaping matplotlib-3.4.3 with matplotlib-3.5.0.dev2445+gb09aad279b, all the rest being strictly equal. it was also bad with rc1, so I tested with last master, thanks t...
Thanks for testing the RC! Do you really need the interactive code _and_ networkx to reproduce? We strongly prefer self-contained issues that don't use downstream libraries. I guess the interactive code may be stripped out. will try. ```` # Networks graph Example : https://github.com/ipython/ipywidgets/blob/maste...
2021-11-05T23:41:59Z
3.4
["lib/matplotlib/tests/test_collections.py::test_set_offset_transform"]
["lib/matplotlib/tests/test_collections.py::test_EllipseCollection[png]", "lib/matplotlib/tests/test_collections.py::test_EventCollection_nosort", "lib/matplotlib/tests/test_collections.py::test_LineCollection_args", "lib/matplotlib/tests/test_collections.py::test__EventCollection__add_positions[pdf]", "lib/matplotlib/...
f93c0a3dcb82feed0262d758626c90d4002685f3
matplotlib/matplotlib
matplotlib__matplotlib-22926
e779b97174ff3ab2737fbdffb432ef8689201602
diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -19,7 +19,7 @@ from . import (_api, _docstring, backend_tools, cbook, colors, ticker, transforms) from .lines import Line2D -from .patches import Circle, Rectangle, Ell...
diff --git a/lib/matplotlib/tests/test_widgets.py b/lib/matplotlib/tests/test_widgets.py --- a/lib/matplotlib/tests/test_widgets.py +++ b/lib/matplotlib/tests/test_widgets.py @@ -1161,6 +1161,23 @@ def handle_positions(slider): assert_allclose(handle_positions(slider), (0.1, 0.34)) +@pytest.mark.parametrize("o...
[Bug]: cannot give init value for RangeSlider widget ### Bug summary I think `xy[4] = .25, val[0]` should be commented in /matplotlib/widgets. py", line 915, in set_val as it prevents to initialized value for RangeSlider ### Code for reproduction ```python import numpy as np import matplotlib.pyplot as plt from matp...
Huh, the polygon object must have changed inadvertently. Usually, you have to "close" the polygon by repeating the first vertex, but we make it possible for polygons to auto-close themselves. I wonder how (when?) this broke? On Tue, Mar 22, 2022 at 10:29 PM vpicouet ***@***.***> wrote: > Bug summary > > I think xy[4]...
2022-04-28T13:39:16Z
3.5
["lib/matplotlib/tests/test_widgets.py::test_range_slider_same_init_values[horizontal]"]
["lib/matplotlib/tests/test_widgets.py::test_CheckButtons", "lib/matplotlib/tests/test_widgets.py::test_MultiCursor[False-True]", "lib/matplotlib/tests/test_widgets.py::test_MultiCursor[True-False]", "lib/matplotlib/tests/test_widgets.py::test_MultiCursor[True-True]", "lib/matplotlib/tests/test_widgets.py::test_TextBox...
de98877e3dc45de8dd441d008f23d88738dc015d
matplotlib/matplotlib
matplotlib__matplotlib-22929
89b21b517df0b2a9c378913bae8e1f184988b554
diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -1083,10 +1083,10 @@ def hlines(self, y, xmin, xmax, colors=None, linestyles='solid', lines._internal_update(kwargs) if len(y) > 0: - minx = mi...
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -7549,6 +7549,26 @@ def test_bar_label_nan_ydata_inverted(): assert labels[0].get_va() == 'bottom' +def test_nan_barlabels(): + fig, ax = plt....
[Bug]: bar_label fails with nan errorbar values ### Bug summary `ax.bar_label` appears not to be robust to bars with missing (nan) values when also including error values. This issue is similar to [#20058](https://github.com/matplotlib/matplotlib/issues/20058/), but occurs in each of three cases: Case 1. When a depe...
I have a solution that works when running in the shell, but not in the test as I get a runtime warning because of the nan-values. Will see if I can find a solution in the next few days.
2022-04-28T16:00:17Z
3.5
["lib/matplotlib/tests/test_axes.py::test_nan_barlabels"]
["lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_2D[png]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[0.5-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[None-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[c_case1-conversion]", "lib/mat...
de98877e3dc45de8dd441d008f23d88738dc015d
matplotlib/matplotlib
matplotlib__matplotlib-23047
3699ff34d6e2d6d649ee0ced5dc3c74936449d67
diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -6651,6 +6651,7 @@ def hist(self, x, bins=None, range=None, density=False, weights=None, m, bins = np.histogram(x[i], bins, weights=w[i], **hist_kwargs) ...
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -1863,6 +1863,21 @@ def test_hist_bar_empty(): ax.hist([], histtype='bar') +def test_hist_float16(): + np.random.seed(19680801) + values = ...
[Bug]: Gaps and overlapping areas between bins when using float16 ### Bug summary When creating a histogram out of float16 data, the bins are also calculated in float16. The lower precision can cause two errors: 1) Gaps between certain bins. 2) Two neighboring bins overlap each other (only visible when alpha < 1) ...
To be checked: Can the same effect occur when using (numpy) int arrays? Just a note that `np.hist(float16)` returns `float16` edges. You may want to try using "stairs" here instead, which won't draw the bars all the way down to zero and help avoid those artifacts. `plt.stairs(*np.histogram(values, bins=100), fill=True...
2022-05-14T13:18:08Z
3.5
["lib/matplotlib/tests/test_axes.py::test_hist_float16"]
["lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_2D[png]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[0.5-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[None-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[c_case1-conversion]", "lib/mat...
de98877e3dc45de8dd441d008f23d88738dc015d
matplotlib/matplotlib
matplotlib__matplotlib-23174
d73ba9e00eddae34610bf9982876b5aa62114ad5
diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -2060,6 +2060,14 @@ def dpi(self): def dpi(self, value): self._parent.dpi = value + @property + def _cachedRenderer(self): + return self._parent._cachedRenderer ...
diff --git a/lib/matplotlib/tests/test_contour.py b/lib/matplotlib/tests/test_contour.py --- a/lib/matplotlib/tests/test_contour.py +++ b/lib/matplotlib/tests/test_contour.py @@ -585,3 +585,23 @@ def test_all_algorithms(): ax.contourf(x, y, z, algorithm=algorithm) ax.contour(x, y, z, algorithm=algorit...
[Bug]: Crash when adding clabels to subfigures ### Bug summary Adding a clabel to a contour plot of a subfigure results in a traceback. ### Code for reproduction ```python # Taken from the Contour Demo example delta = 0.025 x = np.arange(-3.0, 3.0, delta) y = np.arange(-2.0, 2.0, delta) X, Y = np.meshgrid(x, y) Z1 =...
Not sure if one should add `self._cachedRenderer = None` to `FigureBase` (and remove in `Figure`) or to `SubFigure` init-functions, but that should fix it. I thought it was a recent regression, but it doesn't look like it, so maybe should be labelled 3.6.0 instead?
2022-06-01T10:32:18Z
3.5
["lib/matplotlib/tests/test_contour.py::test_subfigure_clabel"]
["lib/matplotlib/tests/test_contour.py::test_algorithm_name[invalid-None]", "lib/matplotlib/tests/test_contour.py::test_algorithm_name[mpl2005-Mpl2005ContourGenerator]", "lib/matplotlib/tests/test_contour.py::test_algorithm_name[mpl2014-Mpl2014ContourGenerator]", "lib/matplotlib/tests/test_contour.py::test_algorithm_na...
de98877e3dc45de8dd441d008f23d88738dc015d
matplotlib/matplotlib
matplotlib__matplotlib-23188
fd4cce73e9d4e7aa5d8a14012d6579861c320cd2
diff --git a/lib/matplotlib/dates.py b/lib/matplotlib/dates.py --- a/lib/matplotlib/dates.py +++ b/lib/matplotlib/dates.py @@ -1157,9 +1157,9 @@ def nonsingular(self, vmin, vmax): if it is too close to being singular (i.e. a range of ~0). """ if not np.isfinite(vmin) or not np.isfinite(vmax):...
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -7087,19 +7087,6 @@ def test_axis_extent_arg2(): assert (ymin, ymax) == ax.get_ylim() -def test_datetime_masked(): - # make sure that all-mask...
[MNT]: default date limits... ### Summary The default date limits are 2000-01-01 to 2010-01-01. This leads to problems as a default if folks add for instance day tickers without specifying the limits. See for instance: #20202 ### Proposed fix We can change these to 1970-01-01 to 1970-01-02. For the default date ...
null
2022-06-02T07:54:57Z
3.5
["lib/matplotlib/tests/test_dates.py::test_DateLocator", "lib/matplotlib/tests/test_dates.py::test_date_empty", "lib/matplotlib/tests/test_dates.py::test_datetime_masked"]
["lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_2D[png]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[0.5-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[None-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[c_case1-conversion]", "lib/mat...
de98877e3dc45de8dd441d008f23d88738dc015d
matplotlib/matplotlib
matplotlib__matplotlib-23198
3407cbc42f0e70595813e2b1816d432591558921
diff --git a/lib/matplotlib/backends/qt_editor/figureoptions.py b/lib/matplotlib/backends/qt_editor/figureoptions.py --- a/lib/matplotlib/backends/qt_editor/figureoptions.py +++ b/lib/matplotlib/backends/qt_editor/figureoptions.py @@ -230,12 +230,12 @@ def apply_callback(data): # re-generate legend, if checkbo...
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -4013,7 +4013,7 @@ def test_hist_stacked_bar(): fig, ax = plt.subplots() ax.hist(d, bins=10, histtype='barstacked', align='mid', color=colors, ...
Inconsistency in keyword-arguments ncol/ncols, nrow/nrows I find it quite inconsistent that one sometimes has to specify `ncols` and sometimes `ncol`. For example: ```python plt.subplots(ncols=2) ``` while ```python axis.legend(ncol=2) ``` (Likewise for `nrows`/`nrow`)
null
2022-06-03T22:30:50Z
3.5
["lib/matplotlib/tests/test_axes.py::test_hist_stacked_bar[pdf]", "lib/matplotlib/tests/test_axes.py::test_hist_stacked_bar[png]", "lib/matplotlib/tests/test_legend.py::test_fancy[pdf]", "lib/matplotlib/tests/test_legend.py::test_fancy[png]", "lib/matplotlib/tests/test_legend.py::test_legend_expand[pdf]", "lib/matplotl...
["lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_2D[png]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[0.5-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[None-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[c_case1-conversion]", "lib/mat...
de98877e3dc45de8dd441d008f23d88738dc015d
matplotlib/matplotlib
matplotlib__matplotlib-23266
dab648ac5eff66a39742f718a356ebe250e01880
diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -701,7 +701,7 @@ def __init__(self, ax, *args, hatches=(None,), alpha=None, origin=None, extent=None, cmap=None, colors=None, norm=None, vmin=None, vm...
diff --git a/lib/matplotlib/tests/test_contour.py b/lib/matplotlib/tests/test_contour.py --- a/lib/matplotlib/tests/test_contour.py +++ b/lib/matplotlib/tests/test_contour.py @@ -605,3 +605,80 @@ def test_subfigure_clabel(): CS = ax.contour(X, Y, Z) ax.clabel(CS, inline=True, fontsize=10) ax....
[ENH]: contour kwarg for negative_linestyle ### Problem if you contour a negative quantity, it gets dashed lines. Leaving aside whether this is a good default or not, the only way to toggle this is via `rcParams['contour.negative_linestyle']=False`. ### Proposed solution I think this should be togglable via kwa...
Should the current `linestyles` kwarg be used to accomplish this or should a new kwarg be added? I have a simple solution adding a new kwarg (though it would need a little more work before it is ready). The following code snippet and images will show a solution with an added kwarg, but I expect this is not exactly wha...
2022-06-14T04:56:38Z
3.5
["lib/matplotlib/tests/test_contour.py::test_linestyles[dashdot]", "lib/matplotlib/tests/test_contour.py::test_linestyles[dashed]", "lib/matplotlib/tests/test_contour.py::test_linestyles[dotted]", "lib/matplotlib/tests/test_contour.py::test_linestyles[solid]", "lib/matplotlib/tests/test_contour.py::test_negative_linest...
["lib/matplotlib/tests/test_contour.py::test_algorithm_name[invalid-None]", "lib/matplotlib/tests/test_contour.py::test_algorithm_name[mpl2005-Mpl2005ContourGenerator]", "lib/matplotlib/tests/test_contour.py::test_algorithm_name[mpl2014-Mpl2014ContourGenerator]", "lib/matplotlib/tests/test_contour.py::test_algorithm_na...
de98877e3dc45de8dd441d008f23d88738dc015d
matplotlib/matplotlib
matplotlib__matplotlib-23348
5f53d997187e883f7fd7b6e0378e900e2384bbf1
diff --git a/examples/widgets/multicursor.py b/examples/widgets/multicursor.py --- a/examples/widgets/multicursor.py +++ b/examples/widgets/multicursor.py @@ -5,22 +5,27 @@ Showing a cursor on multiple plots simultaneously. -This example generates two subplots and on hovering the cursor over data in one -subplot, ...
diff --git a/lib/matplotlib/tests/test_widgets.py b/lib/matplotlib/tests/test_widgets.py --- a/lib/matplotlib/tests/test_widgets.py +++ b/lib/matplotlib/tests/test_widgets.py @@ -1516,11 +1516,12 @@ def test_polygon_selector_box(ax): [(True, True), (True, False), (False, True)], ) def test_MultiCursor(horizOn, v...
MultiCursor should be able to bind to axes in more than one figure... Multicursor only works if all the axes are in the same figure... > Each tab is its own Figure/Canvas. MultiCursor only binds itself to one Canvas so it only sees mouse events from axes on in the figure that canvas is associated with. > The fix he...
This is complicated by https://github.com/matplotlib/matplotlib/issues/21496 .
2022-06-25T22:45:58Z
3.5
["lib/matplotlib/tests/test_widgets.py::test_MultiCursor[False-True]", "lib/matplotlib/tests/test_widgets.py::test_MultiCursor[True-False]", "lib/matplotlib/tests/test_widgets.py::test_MultiCursor[True-True]"]
["lib/matplotlib/tests/test_widgets.py::test_CheckButtons", "lib/matplotlib/tests/test_widgets.py::test_TextBox[none]", "lib/matplotlib/tests/test_widgets.py::test_TextBox[toolbar2]", "lib/matplotlib/tests/test_widgets.py::test_TextBox[toolmanager]", "lib/matplotlib/tests/test_widgets.py::test_check_bunch_of_radio_butt...
de98877e3dc45de8dd441d008f23d88738dc015d
matplotlib/matplotlib
matplotlib__matplotlib-23412
f06c2c3abdaf4b90285ce5ca7fedbb8ace715911
diff --git a/lib/matplotlib/patches.py b/lib/matplotlib/patches.py --- a/lib/matplotlib/patches.py +++ b/lib/matplotlib/patches.py @@ -586,9 +586,8 @@ def draw(self, renderer): # docstring inherited if not self.get_visible(): return - # Patch has traditionally ignored the dashoffse...
diff --git a/lib/matplotlib/tests/test_patches.py b/lib/matplotlib/tests/test_patches.py --- a/lib/matplotlib/tests/test_patches.py +++ b/lib/matplotlib/tests/test_patches.py @@ -149,6 +149,40 @@ def test_rotate_rect_draw(fig_test, fig_ref): assert rect_test.get_angle() == angle +@check_figures_equal(extension...
[Bug]: offset dash linestyle has no effect in patch objects ### Bug summary When setting the linestyle on a patch object using a dash tuple the offset has no effect. ### Code for reproduction ```python import matplotlib.pyplot as plt import matplotlib as mpl plt.figure(figsize=(10,10)) ax = plt.gca() ax.add_patch(m...
Upon digging deeper into this issue it appears that this actually the intended behavior: https://github.com/matplotlib/matplotlib/blob/f8cd2c9f532f65f8b2e3dec6d54e03c48721233c/lib/matplotlib/patches.py#L588 So it might be prudent to just update the docstring to reflect this fact. I'm curious why this was made the de...
2022-07-11T01:41:11Z
3.5
["lib/matplotlib/tests/test_patches.py::test_dash_offset_patch_draw[png]"]
["lib/matplotlib/tests/test_patches.py::test_Polygon_close", "lib/matplotlib/tests/test_patches.py::test_annulus[png]", "lib/matplotlib/tests/test_patches.py::test_annulus_setters2[png]", "lib/matplotlib/tests/test_patches.py::test_annulus_setters[png]", "lib/matplotlib/tests/test_patches.py::test_boxstyle_errors[Round...
de98877e3dc45de8dd441d008f23d88738dc015d
matplotlib/matplotlib
matplotlib__matplotlib-23476
33a0599711d26dc2b79f851c6daed4947df7c167
diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -3023,6 +3023,9 @@ def __getstate__(self): # Set cached renderer to None -- it can't be pickled. state["_cachedRenderer"] = None + # discard any changes to the dpi...
diff --git a/lib/matplotlib/tests/test_figure.py b/lib/matplotlib/tests/test_figure.py --- a/lib/matplotlib/tests/test_figure.py +++ b/lib/matplotlib/tests/test_figure.py @@ -2,6 +2,7 @@ from datetime import datetime import io from pathlib import Path +import pickle import platform from threading import Timer fro...
[Bug]: DPI of a figure is doubled after unpickling on M1 Mac ### Bug summary When a figure is unpickled, it's dpi is doubled. This behaviour happens every time and if done in a loop it can cause an `OverflowError`. ### Code for reproduction ```python import numpy as np import matplotlib import matplotlib.pyplot as p...
I suspect this will also affect anything that know how to deal with high-dpi screens. For, .... reasons..., when we handle high-dpi cases by doubling the dpi on the figure (we have ideas how to fix this, but it is a fair amount of work) when we show it. We are saving the doubled dpi which when re-loaded in doubled ag...
2022-07-22T18:58:22Z
3.5
["lib/matplotlib/tests/test_figure.py::test_unpickle_with_device_pixel_ratio"]
["lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_all_nested[png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x0-png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x1-png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_empty[x0-None-png]", ...
de98877e3dc45de8dd441d008f23d88738dc015d
matplotlib/matplotlib
matplotlib__matplotlib-23742
942aa77a4ba1bd5b50e22c0246240b27ba925305
diff --git a/examples/user_interfaces/embedding_webagg_sgskip.py b/examples/user_interfaces/embedding_webagg_sgskip.py --- a/examples/user_interfaces/embedding_webagg_sgskip.py +++ b/examples/user_interfaces/embedding_webagg_sgskip.py @@ -30,7 +30,7 @@ import matplotlib as mpl -from matplotlib.backends.backend_web...
diff --git a/lib/matplotlib/tests/test_backend_webagg.py b/lib/matplotlib/tests/test_backend_webagg.py --- a/lib/matplotlib/tests/test_backend_webagg.py +++ b/lib/matplotlib/tests/test_backend_webagg.py @@ -2,6 +2,7 @@ import os import sys import pytest +import matplotlib.backends.backend_webagg_core @pytest.ma...
[Bug]: Bug with toolbar instantiation in notebook ### Bug summary In MNE-Python we have an abstraction layer for widgets+toolbars. Until today's latest `pip --pre` install it was working fine. Now it fails with: ``` E TraitError: The 'toolbar' trait of a Canvas instance expected a Toolbar or None, not the Navigatio...
Okay I can replicate on 3.6.0.rc0 in a notebook with just: ``` %matplotlib widget import matplotlib.pyplot as plt fig, ax = plt.subplots() ``` <details> <summary>Traceback</summary> ``` --------------------------------------------------------------------------- TraitError Traceback (mos...
2022-08-26T01:13:33Z
3.5
["lib/matplotlib/tests/test_backend_webagg.py::test_webagg_core_no_toolbar"]
["lib/matplotlib/tests/test_backend_webagg.py::test_webagg_fallback[nbagg]", "lib/matplotlib/tests/test_backend_webagg.py::test_webagg_fallback[webagg]"]
de98877e3dc45de8dd441d008f23d88738dc015d
matplotlib/matplotlib
matplotlib__matplotlib-24013
394748d584d1cd5c361a6a4c7b70d7b8a8cd3ef0
diff --git a/lib/matplotlib/tri/__init__.py b/lib/matplotlib/tri/__init__.py --- a/lib/matplotlib/tri/__init__.py +++ b/lib/matplotlib/tri/__init__.py @@ -2,15 +2,15 @@ Unstructured triangular grid functions. """ -from .triangulation import Triangulation -from .tricontour import TriContourSet, tricontour, tricontou...
diff --git a/lib/matplotlib/tests/test_triangulation.py b/lib/matplotlib/tests/test_triangulation.py --- a/lib/matplotlib/tests/test_triangulation.py +++ b/lib/matplotlib/tests/test_triangulation.py @@ -614,15 +614,15 @@ def poisson_sparse_matrix(n, m): # Instantiating a sparse Poisson matrix of size 48 x 48: ...
function shadowing their own definition modules I'm not sure if this is really a "bug" report but more of an unexpected interaction. The short reason for this is that I'm working on improving the documentation in IPython and need a bijection object <-> fully qualified name which is made difficult by the following. I ta...
I agree with renaming all the `tri/foo.py` modules to `tri/_foo.py` (`tri/__init__.py` already reexports everything anyways). I'm not sure it's possible to have a proper deprecation for `from matplotlib.tri.tripcolor import tripcolor` (without ridiculous hacks)?
2022-09-26T18:56:52Z
3.6
["lib/matplotlib/tests/test_triangulation.py::test_triinterpcubic_cg_solver", "lib/matplotlib/tests/test_triangulation.py::test_triinterpcubic_geom_weights"]
["lib/matplotlib/tests/test_triangulation.py::TestTriangulationParams::test_extract_triangulation_params[args0-kwargs0-expected0]", "lib/matplotlib/tests/test_triangulation.py::TestTriangulationParams::test_extract_triangulation_params[args1-kwargs1-expected1]", "lib/matplotlib/tests/test_triangulation.py::TestTriangul...
73909bcb408886a22e2b84581d6b9e6d9907c813
matplotlib/matplotlib
matplotlib__matplotlib-24026
14c96b510ebeba40f573e512299b1976f35b620e
diff --git a/lib/matplotlib/stackplot.py b/lib/matplotlib/stackplot.py --- a/lib/matplotlib/stackplot.py +++ b/lib/matplotlib/stackplot.py @@ -6,6 +6,8 @@ (https://stackoverflow.com/users/66549/doug) """ +import itertools + import numpy as np from matplotlib import _api @@ -70,7 +72,9 @@ def stackplot(axes, x, ...
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -2851,10 +2851,11 @@ def test_stackplot(): ax.set_xlim((0, 10)) ax.set_ylim((0, 70)) - # Reuse testcase from above for a labeled data test ...
stackplot should not change Axes cycler Usecase: I am producing various types of plots (some use rectangle collections, some regular plot-lines, some stacked plots) and wish to keep the colors synchronized across plot types for consistency and ease of comparison. While `ax.plot()` and `matplotlib.patches.Rectangle()` ...
null
2022-09-28T02:45:01Z
3.6
["lib/matplotlib/tests/test_axes.py::test_stackplot[pdf]", "lib/matplotlib/tests/test_axes.py::test_stackplot[png]"]
["lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_2D[png]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[0.5-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[None-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[c_case1-conversion]", "lib/mat...
73909bcb408886a22e2b84581d6b9e6d9907c813
matplotlib/matplotlib
matplotlib__matplotlib-24088
0517187b9c91061d2ec87e70442615cf4f47b6f3
diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -1253,11 +1253,13 @@ def colorbar( # Store the value of gca so that we can set it back later on. if cax is None: if ax is None: - raise ValueErr...
diff --git a/lib/matplotlib/tests/test_colorbar.py b/lib/matplotlib/tests/test_colorbar.py --- a/lib/matplotlib/tests/test_colorbar.py +++ b/lib/matplotlib/tests/test_colorbar.py @@ -1,10 +1,12 @@ import numpy as np import pytest +from matplotlib import _api from matplotlib import cm import matplotlib.colors as m...
[Bug]: ValueError: Unable to determine Axes to steal space for Colorbar. ### Bug summary `matplotlib==3.6.0` started raising an error when trying to add a colorbar to `plt.hist()`: ValueError: Unable to determine Axes to steal space for Colorbar. Either provide the *cax* argument to use as the Axes for the Colorbar, ...
The error disappears in 3.6.0 by following the error message and passing `cax=ax.inset_axes([0.95, 0.1, 0.05, 0.8])`. If it is ambiguous what axes to use, pass in the axes directly: ``` cbar = plt.colorbar( plt.cm.ScalarMappable(cmap=color_map), ax=plt.gca() ) ``` You _could_ make an axes, and use that, but ...
2022-10-03T22:25:59Z
3.6
["lib/matplotlib/tests/test_colorbar.py::test_parentless_mappable"]
["lib/matplotlib/tests/test_colorbar.py::test_anchored_cbar_position_using_specgrid", "lib/matplotlib/tests/test_colorbar.py::test_aspects", "lib/matplotlib/tests/test_colorbar.py::test_axes_handles_same_functions[png]", "lib/matplotlib/tests/test_colorbar.py::test_boundaries[png]", "lib/matplotlib/tests/test_colorbar....
73909bcb408886a22e2b84581d6b9e6d9907c813
matplotlib/matplotlib
matplotlib__matplotlib-24362
aca6e9d5e98811ca37c442217914b15e78127c89
diff --git a/lib/matplotlib/gridspec.py b/lib/matplotlib/gridspec.py --- a/lib/matplotlib/gridspec.py +++ b/lib/matplotlib/gridspec.py @@ -276,21 +276,12 @@ def subplots(self, *, sharex=False, sharey=False, squeeze=True, raise ValueError("GridSpec.subplots() only works for GridSpecs " ...
diff --git a/lib/matplotlib/tests/test_subplots.py b/lib/matplotlib/tests/test_subplots.py --- a/lib/matplotlib/tests/test_subplots.py +++ b/lib/matplotlib/tests/test_subplots.py @@ -84,7 +84,7 @@ def test_shared(): plt.close(f) # test all option combinations - ops = [False, True, 'all', 'none', 'row', '...
[Bug]: sharex and sharey don't accept 0 and 1 as bool values ### Bug summary When using `0` or `1` in place of `False` or `True` in `sharex` or `sharex` arguments of `pyplot.subplots` an error is raised. ### Code for reproduction ```python import matplotlib.pyplot as plt fig, ax = plt.subplots(ncols=2,sharey=1) ```...
null
2022-11-04T10:37:58Z
3.6
["lib/matplotlib/tests/test_subplots.py::test_shared"]
["lib/matplotlib/tests/test_subplots.py::test_dont_mutate_kwargs", "lib/matplotlib/tests/test_subplots.py::test_exceptions", "lib/matplotlib/tests/test_subplots.py::test_get_gridspec", "lib/matplotlib/tests/test_subplots.py::test_label_outer_non_gridspec", "lib/matplotlib/tests/test_subplots.py::test_label_outer_span",...
73909bcb408886a22e2b84581d6b9e6d9907c813
matplotlib/matplotlib
matplotlib__matplotlib-24403
8d8ae7fe5b129af0fef45aefa0b3e11394fcbe51
diff --git a/lib/matplotlib/axes/_axes.py b/lib/matplotlib/axes/_axes.py --- a/lib/matplotlib/axes/_axes.py +++ b/lib/matplotlib/axes/_axes.py @@ -4416,7 +4416,7 @@ def invalid_shape_exception(csize, xsize): # severe failure => one may appreciate a verbose feedback. raise Value...
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -8290,3 +8290,17 @@ def test_extent_units(): with pytest.raises(ValueError, match="set_extent did not consume all of the kwar...
[ENH]: Use `repr` instead of `str` in the error message ### Problem I mistakenly supplied `"blue\n"` as the argument `c` for [`matplotlib.axes.Axes.scatter `](https://matplotlib.org/stable/api/_as_gen/matplotlib.axes.Axes.scatter.html#matplotlib-axes-axes-scatter), then `matplitlib` claimed for illegal color name like...
Labeling this as a good first issue as this is a straight forward change that should not bring up any API design issues (yes technically changing the wording of an error message may break someone, but that is so brittle I am not going to worry about that). Will need a test (the new line example is a good one!). @e5f6b...
2022-11-08T19:05:49Z
3.6
["lib/matplotlib/tests/test_axes.py::test_scatter_color_repr_error"]
["lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_2D[png]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[0.5-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[None-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[c_case1-conversion]", "lib/mat...
73909bcb408886a22e2b84581d6b9e6d9907c813
matplotlib/matplotlib
matplotlib__matplotlib-24604
3393a4f22350e5df7aa8d3c7904e26e81428d2cd
diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -1759,6 +1759,25 @@ def get_tightbbox(self, renderer=None, bbox_extra_artists=None): return _bbox + @staticmethod + def _norm_per_subplot_kw(per_subplot_kw): + expa...
diff --git a/lib/matplotlib/tests/test_figure.py b/lib/matplotlib/tests/test_figure.py --- a/lib/matplotlib/tests/test_figure.py +++ b/lib/matplotlib/tests/test_figure.py @@ -848,7 +848,12 @@ def test_animated_with_canvas_change(fig_test, fig_ref): class TestSubplotMosaic: @check_figures_equal(extensions=["png"])...
[ENH]: gridspec_mosaic ### Problem Trying to combine subplot_mosaic with axes using various different projections (e.g. one rectilinear axes and one polar axes and one 3d axes) has been requested a few times (once in the original subplot_mosaic thread IIRC, and in #20392 too), and it's something I would recently have ...
I like this better than the current create/remove/replace scheme, but just to be clear- using this method means folks would have to go in manually and create a subplot for each spec, right? So this feature is just providing the ability to layout and identify axes in the same way as subplot_mosaic? We could do this, b...
2022-12-03T20:20:12Z
3.6
["lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_extra_per_subplot_kw", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_per_subplot_kw[BC-png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_per_subplot_kw[multi_value1-png]", "lib/matplotlib/tests/test_figure.py::TestSubplotM...
["lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_all_nested[png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x0-png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x1-png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x2-png]", "lib/...
73909bcb408886a22e2b84581d6b9e6d9907c813
matplotlib/matplotlib
matplotlib__matplotlib-24768
ecf6e26f0b0241bdc80466e13ee0c13a0c12f412
diff --git a/lib/matplotlib/axes/_base.py b/lib/matplotlib/axes/_base.py --- a/lib/matplotlib/axes/_base.py +++ b/lib/matplotlib/axes/_base.py @@ -3127,23 +3127,23 @@ def draw(self, renderer): if (rasterization_zorder is not None and artists and artists[0].zorder < rasterization_zorder): - ...
diff --git a/lib/matplotlib/tests/test_axes.py b/lib/matplotlib/tests/test_axes.py --- a/lib/matplotlib/tests/test_axes.py +++ b/lib/matplotlib/tests/test_axes.py @@ -8449,3 +8449,11 @@ def get_next_color(): c = 'red\n' mpl.axes.Axes._parse_scatter_color_args( c, None, kwargs={}, xsize=2,...
[Bug]: pcolormesh(rasterized=True) conflicts with set_rasterization_zorder() ### Bug summary According to the [documentation](https://matplotlib.org/stable/gallery/misc/rasterization_demo.html), a color plot can be rasterized in two ways: * `pyplot.pcolormesh(…, rasterized=True)` * `pyplot.gca().set_rasterization_zor...
null
2022-12-18T20:07:59Z
3.6
["lib/matplotlib/tests/test_axes.py::test_zorder_and_explicit_rasterization"]
["lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_2D[png]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[0.5-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[None-None]", "lib/matplotlib/tests/test_axes.py::TestScatter::test_scatter_c[c_case1-conversion]", "lib/mat...
73909bcb408886a22e2b84581d6b9e6d9907c813
matplotlib/matplotlib
matplotlib__matplotlib-24849
75e2d2202dc19ee39c8b9a80b01475b90f07c75c
diff --git a/lib/matplotlib/collections.py b/lib/matplotlib/collections.py --- a/lib/matplotlib/collections.py +++ b/lib/matplotlib/collections.py @@ -9,6 +9,7 @@ line segments). """ +import itertools import math from numbers import Number import warnings @@ -163,6 +164,9 @@ def __init__(self, # list of...
diff --git a/lib/matplotlib/tests/test_collections.py b/lib/matplotlib/tests/test_collections.py --- a/lib/matplotlib/tests/test_collections.py +++ b/lib/matplotlib/tests/test_collections.py @@ -1,5 +1,6 @@ from datetime import datetime import io +import itertools import re from types import SimpleNamespace @@ -1...
[Bug]: gapcolor not supported for LineCollections ### Bug summary [LineCollection](https://github.com/matplotlib/matplotlib/blob/509315008ce383f7fb5b2dbbdc2a5a966dd83aad/lib/matplotlib/collections.py#L1351) doesn't have a `get_gapcolor` or `set_gapcolor`, so gapcolor doesn't work in plotting methods that return LineCo...
I had a look at this. Although the `LineCollection` docstring states that it “Represents a sequence of Line2Ds”, it doesn’t seem to use the `Line2D` object (unless I’m missing something). So I think we might need to modify the `Collection.draw` method in an analogous way to how we did the `Line2D.draw` method at #232...
2022-12-31T10:19:18Z
3.6
["lib/matplotlib/tests/test_collections.py::test_striped_lines[png-gapcolor1]", "lib/matplotlib/tests/test_collections.py::test_striped_lines[png-orange]"]
["lib/matplotlib/tests/test_collections.py::test_EllipseCollection[png]", "lib/matplotlib/tests/test_collections.py::test_EventCollection_nosort", "lib/matplotlib/tests/test_collections.py::test_LineCollection_args", "lib/matplotlib/tests/test_collections.py::test__EventCollection__add_positions[pdf]", "lib/matplotlib/...
73909bcb408886a22e2b84581d6b9e6d9907c813
matplotlib/matplotlib
matplotlib__matplotlib-24870
6091437be9776139d3672cde28a19cbe6c09dcd5
diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -1117,15 +1117,20 @@ def _autolev(self, N): return lev[i0:i1] - def _process_contour_level_args(self, args): + def _process_contour_level_args(self, args, z_dtype): ...
diff --git a/lib/matplotlib/tests/test_contour.py b/lib/matplotlib/tests/test_contour.py --- a/lib/matplotlib/tests/test_contour.py +++ b/lib/matplotlib/tests/test_contour.py @@ -693,3 +693,20 @@ def test_contour_remove(): assert ax.get_children() != orig_children cs.remove() assert ax.get_children() == ...
[ENH]: Auto-detect bool arrays passed to contour()? ### Problem I find myself fairly regularly calling ```python plt.contour(boolean_2d_array, levels=[.5], ...) ``` to draw the boundary line between True and False regions on a boolean 2d array. Without `levels=[.5]`, one gets the default 8 levels which go at 0, 0.15,...
Sounds reasonable. Levels has an automatic default. If we can make that better for bool arrays, let's do it. Side-remark: I tried your code with `contourf()`, but that raises "Filled contours require at least 2 levels". Maybe you want to look at that as well? For contourf(bool_array) the natural levels would be [0, .5...
2023-01-02T20:37:49Z
3.6
["lib/matplotlib/tests/test_contour.py::test_bool_autolevel"]
["lib/matplotlib/tests/test_contour.py::test_algorithm_name[invalid-None]", "lib/matplotlib/tests/test_contour.py::test_algorithm_name[mpl2005-Mpl2005ContourGenerator]", "lib/matplotlib/tests/test_contour.py::test_algorithm_name[mpl2014-Mpl2014ContourGenerator]", "lib/matplotlib/tests/test_contour.py::test_algorithm_na...
73909bcb408886a22e2b84581d6b9e6d9907c813
matplotlib/matplotlib
matplotlib__matplotlib-24971
a3011dfd1aaa2487cce8aa7369475533133ef777
diff --git a/lib/matplotlib/_tight_bbox.py b/lib/matplotlib/_tight_bbox.py --- a/lib/matplotlib/_tight_bbox.py +++ b/lib/matplotlib/_tight_bbox.py @@ -17,8 +17,6 @@ def adjust_bbox(fig, bbox_inches, fixed_dpi=None): """ origBbox = fig.bbox origBboxInches = fig.bbox_inches - orig_layout = fig.get_layou...
diff --git a/lib/matplotlib/tests/test_figure.py b/lib/matplotlib/tests/test_figure.py --- a/lib/matplotlib/tests/test_figure.py +++ b/lib/matplotlib/tests/test_figure.py @@ -532,6 +532,13 @@ def test_savefig_pixel_ratio(backend): assert ratio1 == ratio2 +def test_savefig_preserve_layout_engine(tmp_path): + ...
[Bug]: compressed layout setting can be forgotten on second save ### Bug summary I'm not sure whether this is really a bug or I'm just using an inconsistent combination of options. Under some specific circumstances (see below) compressed layout is not applied the second time a figure is saved. ### Code for reproduct...
Yeah we do some dancing around when we save with bbox inches - so this seems to get caught in that. I tried to track it down, but the figure-saving stack is full of context managers, and I can't see where the layout manager gets reset. Hopefully someone more cognizant of that part of the codebase can explain. Thank...
2023-01-13T14:32:35Z
3.6
["lib/matplotlib/tests/test_figure.py::test_savefig_preserve_layout_engine"]
["lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_all_nested[png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x0-png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x1-png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x2-png]", "lib/...
73909bcb408886a22e2b84581d6b9e6d9907c813
matplotlib/matplotlib
matplotlib__matplotlib-25281
5aee26d0a52c237c5b4fafcb843e392907ab45b3
diff --git a/lib/matplotlib/legend.py b/lib/matplotlib/legend.py --- a/lib/matplotlib/legend.py +++ b/lib/matplotlib/legend.py @@ -23,6 +23,7 @@ import itertools import logging +import numbers import time import numpy as np @@ -517,6 +518,9 @@ def val_or_rc(val, rc_name): if not self.isaxes and loc...
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 @@ -1219,3 +1219,79 @@ def test_ncol_ncols(fig_test, fig_ref): ncols = 3 fig_test.legend(strings, ncol=ncols) fig_ref.legend(strings, ...
[Bug]: Validation not performed for `loc` argument to `legend` ### Bug summary When passing non-str `loc` values to `legend`, validation is not performed. So even for invalid inputs, errors are raised only when we call `show()` ### Code for reproduction ```python >>> import matplotlib.pyplot as plt >>> import matplo...
The work here is to : - sort out what the validation _should be_ (read the code where the above traceback starts) - add logic to `Legend.__init__` to validate loc - add tests - update docstring to legend (in both `Legend` and `Axes.legend`) This is a good first issue because it should only require understanding a...
2023-02-22T05:06:30Z
3.7
["lib/matplotlib/tests/test_legend.py::test_loc_invalid_list_exception", "lib/matplotlib/tests/test_legend.py::test_loc_invalid_tuple_exception", "lib/matplotlib/tests/test_legend.py::test_loc_invalid_type", "lib/matplotlib/tests/test_legend.py::test_loc_validation_numeric_value"]
["lib/matplotlib/tests/test_legend.py::TestLegendFigureFunction::test_legend_handle_label", "lib/matplotlib/tests/test_legend.py::TestLegendFigureFunction::test_legend_kw_args", "lib/matplotlib/tests/test_legend.py::TestLegendFigureFunction::test_legend_label_arg", "lib/matplotlib/tests/test_legend.py::TestLegendFigure...
0849036fd992a2dd133a0cffc3f84f58ccf1840f
matplotlib/matplotlib
matplotlib__matplotlib-25404
b51a227058e16cdbc56890f49e3a0888ea02b9d2
diff --git a/lib/matplotlib/widgets.py b/lib/matplotlib/widgets.py --- a/lib/matplotlib/widgets.py +++ b/lib/matplotlib/widgets.py @@ -2457,15 +2457,16 @@ def artists(self): def set_props(self, **props): """ - Set the properties of the selector artist. See the `props` argument - in the sel...
diff --git a/lib/matplotlib/tests/test_widgets.py b/lib/matplotlib/tests/test_widgets.py --- a/lib/matplotlib/tests/test_widgets.py +++ b/lib/matplotlib/tests/test_widgets.py @@ -987,6 +987,19 @@ def test_lasso_selector(ax, kwargs): onselect.assert_called_once_with([(100, 100), (125, 125), (150, 150)]) +def te...
[Bug]: AttributeError: 'LassoSelector' object has no attribute '_props' ### Summary I used the LassoSelector object to select the single point in the scatterplot. But when I try to update the line color of LassoSelector with the set_props function, I get an error like this **AttributeError: 'LassoSelector' object has ...
The properties for `LassoSelector` is applied to the line stored as `self._selection_artist`. As such `self._props` is not defined in the constructor. I *think* the correct solution is to redefine `set_props` for `LassoSelector` (and in that method set the props of the line), but there may be someone knowing better. F...
2023-03-07T09:33:22Z
3.7
["lib/matplotlib/tests/test_widgets.py::test_lasso_selector_set_props"]
["lib/matplotlib/tests/test_widgets.py::test_CheckButtons", "lib/matplotlib/tests/test_widgets.py::test_MultiCursor[False-False]", "lib/matplotlib/tests/test_widgets.py::test_MultiCursor[False-True]", "lib/matplotlib/tests/test_widgets.py::test_MultiCursor[True-False]", "lib/matplotlib/tests/test_widgets.py::test_Multi...
0849036fd992a2dd133a0cffc3f84f58ccf1840f
matplotlib/matplotlib
matplotlib__matplotlib-25430
7eafdd8af3c523c1c77b027d378fb337dd489f18
diff --git a/lib/matplotlib/backends/backend_agg.py b/lib/matplotlib/backends/backend_agg.py --- a/lib/matplotlib/backends/backend_agg.py +++ b/lib/matplotlib/backends/backend_agg.py @@ -441,7 +441,9 @@ def buffer_rgba(self): """ return self.renderer.buffer_rgba() - def print_raw(self, filename_o...
diff --git a/lib/matplotlib/tests/test_figure.py b/lib/matplotlib/tests/test_figure.py --- a/lib/matplotlib/tests/test_figure.py +++ b/lib/matplotlib/tests/test_figure.py @@ -1548,3 +1548,14 @@ def test_gridspec_no_mutate_input(): plt.subplots(1, 2, width_ratios=[1, 2], gridspec_kw=gs) assert gs == gs_orig ...
[Bug]: savefig + jpg + metadata fails with inscrutable error message ### Bug summary If we call `savefig` with a `filename` with a `.jpg` extension, with the `metadata` kwarg specified, the error message is inscrutable. ### Code for reproduction ```python #!/usr/bin/env python3 import matplotlib.pyplot as plt import...
Ultimately the jpg writer does not support metadata. If it could, that would be the most ideal solution for at least the narrow case. (Though this is not at all specific to jpg, while many of the most common formats such as png, pdf, or svg do accept metadata, not all do) I could see an argument for failing a bit earl...
2023-03-11T02:40:44Z
3.7
["lib/matplotlib/tests/test_figure.py::test_savefig_metadata_error[jpeg]", "lib/matplotlib/tests/test_figure.py::test_savefig_metadata_error[jpg]", "lib/matplotlib/tests/test_figure.py::test_savefig_metadata_error[raw]", "lib/matplotlib/tests/test_figure.py::test_savefig_metadata_error[rgba]", "lib/matplotlib/tests/tes...
["lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_all_nested[png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x0-png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x1-png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x2-png]", "lib/...
0849036fd992a2dd133a0cffc3f84f58ccf1840f
matplotlib/matplotlib
matplotlib__matplotlib-25433
7eafdd8af3c523c1c77b027d378fb337dd489f18
diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -931,6 +931,7 @@ def _break_share_link(ax, grouper): self._axobservers.process("_axes_change_event", self) self.stale = True self._localaxes.remove(ax) + se...
diff --git a/lib/matplotlib/tests/test_backend_bases.py b/lib/matplotlib/tests/test_backend_bases.py --- a/lib/matplotlib/tests/test_backend_bases.py +++ b/lib/matplotlib/tests/test_backend_bases.py @@ -95,6 +95,16 @@ def test_non_gui_warning(monkeypatch): in str(rec[0].message)) +def test_grab_cle...
[Bug]: using clf and pyplot.draw in range slider on_changed callback blocks input to widgets ### Bug summary When using clear figure, adding new widgets and then redrawing the current figure in the on_changed callback of a range slider the inputs to all the widgets in the figure are blocked. When doing the same in the...
A can confirm this behavior, but removing and recreating the objects that host the callbacks in the callbacks is definitely on the edge of the intended usage. Why are you doing this? In your application can you get away with not destroying your slider? I think there could be a way to not destroy the slider. But I d...
2023-03-11T08:36:32Z
3.7
["lib/matplotlib/tests/test_backend_bases.py::test_grab_clear"]
["lib/matplotlib/tests/test_backend_bases.py::test_canvas_change", "lib/matplotlib/tests/test_backend_bases.py::test_canvas_ctor", "lib/matplotlib/tests/test_backend_bases.py::test_draw[pdf]", "lib/matplotlib/tests/test_backend_bases.py::test_draw[pgf]", "lib/matplotlib/tests/test_backend_bases.py::test_draw[ps]", "lib...
0849036fd992a2dd133a0cffc3f84f58ccf1840f
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::TestAsinhNorm::test_init", "lib/matplotlib/tests/test_colors.py::TestAsinhNorm::test_norm", "lib/matplotlib/tests/test_colors.py::test_2d_to_rgba", "lib/matplotlib/tests/test_colors.py::test_BoundaryNorm", "lib/matplotlib/tests/test_colors.py::test_CenteredNorm", "lib/matplotlib/t...
0849036fd992a2dd133a0cffc3f84f58ccf1840f
matplotlib/matplotlib
matplotlib__matplotlib-25498
78bf53caacbb5ce0dc7aa73f07a74c99f1ed919b
diff --git a/lib/matplotlib/colorbar.py b/lib/matplotlib/colorbar.py --- a/lib/matplotlib/colorbar.py +++ b/lib/matplotlib/colorbar.py @@ -301,11 +301,6 @@ def __init__(self, ax, mappable=None, *, cmap=None, if mappable is None: mappable = cm.ScalarMappable(norm=norm, cmap=cmap) - # Ensur...
diff --git a/lib/matplotlib/tests/test_colorbar.py b/lib/matplotlib/tests/test_colorbar.py --- a/lib/matplotlib/tests/test_colorbar.py +++ b/lib/matplotlib/tests/test_colorbar.py @@ -657,6 +657,12 @@ def test_colorbar_scale_reset(): assert cbar.outline.get_edgecolor() == mcolors.to_rgba('red') + # log scale...
Update colorbar after changing mappable.norm How can I update a colorbar, after I changed the norm instance of the colorbar? `colorbar.update_normal(mappable)` has now effect and `colorbar.update_bruteforce(mappable)` throws a `ZeroDivsionError`-Exception. Consider this example: ``` python import matplotlib.pyplot a...
You have run into a big bug in imshow, not colorbar. As a workaround, after setting `plot.norm`, call `plot.autoscale()`. Then the `update_bruteforce` will work. When the norm is changed, it should pick up the vmax, vmin values from the autoscaling; but this is not happening. Actually, it's worse than that; it fails...
2023-03-18T17:01:11Z
3.7
["lib/matplotlib/tests/test_colorbar.py::test_colorbar_scale_reset"]
["lib/matplotlib/tests/test_colorbar.py::test_anchored_cbar_position_using_specgrid", "lib/matplotlib/tests/test_colorbar.py::test_aspects", "lib/matplotlib/tests/test_colorbar.py::test_axes_handles_same_functions[png]", "lib/matplotlib/tests/test_colorbar.py::test_boundaries[png]", "lib/matplotlib/tests/test_colorbar....
0849036fd992a2dd133a0cffc3f84f58ccf1840f
matplotlib/matplotlib
matplotlib__matplotlib-25651
bff46815c9b6b2300add1ed25f18b3d788b816de
diff --git a/lib/matplotlib/ticker.py b/lib/matplotlib/ticker.py --- a/lib/matplotlib/ticker.py +++ b/lib/matplotlib/ticker.py @@ -2244,6 +2244,7 @@ class LogLocator(Locator): """ + @_api.delete_parameter("3.8", "numdecs") def __init__(self, base=10.0, subs=(1.0,), numdecs=4, numticks=None): "...
diff --git a/lib/matplotlib/tests/test_ticker.py b/lib/matplotlib/tests/test_ticker.py --- a/lib/matplotlib/tests/test_ticker.py +++ b/lib/matplotlib/tests/test_ticker.py @@ -233,9 +233,11 @@ def test_set_params(self): See if change was successful. Should not raise exception. """ loc = mticke...
[MNT]: numdecs parameter in `LogLocator` ### Summary `LogLocator` takes a parameter *numdecs*, which is not described in its docstring. I also can't find anywhere the parameter is used in the code. https://matplotlib.org/devdocs/api/ticker_api.html#matplotlib.ticker.LogLocator *numdec* (no s) is used within `tick_va...
null
2023-04-09T12:42:22Z
3.7
["lib/matplotlib/tests/test_ticker.py::TestLogLocator::test_set_params"]
["lib/matplotlib/tests/test_ticker.py::TestAsinhLocator::test_base_rounding", "lib/matplotlib/tests/test_ticker.py::TestAsinhLocator::test_fallback", "lib/matplotlib/tests/test_ticker.py::TestAsinhLocator::test_init", "lib/matplotlib/tests/test_ticker.py::TestAsinhLocator::test_linear_values", "lib/matplotlib/tests/tes...
0849036fd992a2dd133a0cffc3f84f58ccf1840f
matplotlib/matplotlib
matplotlib__matplotlib-25785
950d0db55ac04e663d523144882af0ec2d172420
diff --git a/lib/matplotlib/backends/backend_ps.py b/lib/matplotlib/backends/backend_ps.py --- a/lib/matplotlib/backends/backend_ps.py +++ b/lib/matplotlib/backends/backend_ps.py @@ -867,18 +867,24 @@ def _print_figure( # find the appropriate papertype width, height = self.figure.get_size_inches() ...
diff --git a/lib/matplotlib/tests/test_backend_ps.py b/lib/matplotlib/tests/test_backend_ps.py --- a/lib/matplotlib/tests/test_backend_ps.py +++ b/lib/matplotlib/tests/test_backend_ps.py @@ -336,3 +336,12 @@ def test_colorbar_shift(tmp_path): norm = mcolors.BoundaryNorm([-1, -0.5, 0.5, 1], cmap.N) plt.scatter...
automatic papersize selection by ps backend is almost certainly broken No minimal example, but the relevant chunk (`backend_ps.py`) is ```python papersize = {'letter': (8.5,11), 'legal': (8.5,14), 'ledger': (11,17), 'a0': (33.11,46.81), 'a1': (23.39,33.11), ...
Currently the code looks like: https://github.com/matplotlib/matplotlib/blob/9caa261595267001d75334a00698da500b0e4eef/lib/matplotlib/backends/backend_ps.py#L80-L85 so slightly different sorting. I guess that `sorted(papersize.items(), key=lambda v: v[1])` will be better as it gives: ``` {'a10': (1.02, 1.46), 'b10': (1...
2023-04-28T02:15:05Z
3.7
["lib/matplotlib/tests/test_backend_ps.py::test_auto_papersize_deprecation"]
["lib/matplotlib/tests/test_backend_ps.py::test_bbox", "lib/matplotlib/tests/test_backend_ps.py::test_colorbar_shift[eps]", "lib/matplotlib/tests/test_backend_ps.py::test_colored_hatch_zero_linewidth[eps]", "lib/matplotlib/tests/test_backend_ps.py::test_d_glyph", "lib/matplotlib/tests/test_backend_ps.py::test_empty_lin...
0849036fd992a2dd133a0cffc3f84f58ccf1840f
matplotlib/matplotlib
matplotlib__matplotlib-25960
1d0d255b79e84dfc9f2123c5eb85a842d342f72b
diff --git a/lib/matplotlib/figure.py b/lib/matplotlib/figure.py --- a/lib/matplotlib/figure.py +++ b/lib/matplotlib/figure.py @@ -1564,8 +1564,9 @@ def subfigures(self, nrows=1, ncols=1, squeeze=True, wspace, hspace : float, default: None The amount of width/height reserved for space between subf...
diff --git a/lib/matplotlib/tests/test_figure.py b/lib/matplotlib/tests/test_figure.py --- a/lib/matplotlib/tests/test_figure.py +++ b/lib/matplotlib/tests/test_figure.py @@ -1449,6 +1449,31 @@ def test_subfigure_pdf(): fig.savefig(buffer, format='pdf') +def test_subfigures_wspace_hspace(): + sub_figs = plt...
[Bug]: wspace and hspace in subfigures not working ### Bug summary `wspace` and `hspace` in `Figure.subfigures` do nothing. ### Code for reproduction ```python import matplotlib.pyplot as plt figs = plt.figure().subfigures(2, 2, wspace=0, hspace=0) for fig in figs.flat: fig.subplots().plot([1, 2]) plt.show() ``...
Thanks for the report @maurosilber. The problem is clearer if we set a facecolor for each subfigure: ```python import matplotlib.pyplot as plt for space in [0, 0.2]: figs = plt.figure().subfigures(2, 2, hspace=space, wspace=space) for fig, color in zip(figs.flat, 'cmyw'): fig.set_facecolor(color) ...
2023-05-23T21:58:53Z
3.7
["lib/matplotlib/tests/test_figure.py::test_subfigures_wspace_hspace"]
["lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_all_nested[png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x0-png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x1-png]", "lib/matplotlib/tests/test_figure.py::TestSubplotMosaic::test_basic[x2-png]", "lib/...
0849036fd992a2dd133a0cffc3f84f58ccf1840f
matplotlib/matplotlib
matplotlib__matplotlib-26024
bfaa6eb677b9c56cafb6a99d6897c9d0cd9d4210
diff --git a/lib/matplotlib/_mathtext_data.py b/lib/matplotlib/_mathtext_data.py --- a/lib/matplotlib/_mathtext_data.py +++ b/lib/matplotlib/_mathtext_data.py @@ -1008,8 +1008,6 @@ 'leftparen' : 40, 'rightparen' : 41, 'bigoplus' : 10753, - 'leftangle' ...
diff --git a/lib/matplotlib/tests/test_mathtext.py b/lib/matplotlib/tests/test_mathtext.py --- a/lib/matplotlib/tests/test_mathtext.py +++ b/lib/matplotlib/tests/test_mathtext.py @@ -510,3 +510,31 @@ def test_mathtext_cmr10_minus_sign(): ax.plot(range(-1, 1), range(-1, 1)) # draw to make sure we have no warni...
[ENH]: Missing mathematical operations ### Problem Just browsed the available mathematical operators and compared with the ones defined. (One can probably do a similar thing with other groups of symbols.) ### Proposed solution The following are missing (as in not defined in `tex2uni` in `_mathtext_data.py`, in hex)...
null
2023-06-01T04:01:41Z
3.7
["lib/matplotlib/tests/test_mathtext.py::test_mathtext_operators"]
["lib/matplotlib/tests/test_mathtext.py::test_argument_order", "lib/matplotlib/tests/test_mathtext.py::test_default_math_fontfamily", "lib/matplotlib/tests/test_mathtext.py::test_fontinfo", "lib/matplotlib/tests/test_mathtext.py::test_genfrac_displaystyle[png]", "lib/matplotlib/tests/test_mathtext.py::test_get_unicode_...
0849036fd992a2dd133a0cffc3f84f58ccf1840f
matplotlib/matplotlib
matplotlib__matplotlib-26249
f017315dd5e56c367e43fc7458fd0ed5fd9482a2
diff --git a/lib/mpl_toolkits/mplot3d/axes3d.py b/lib/mpl_toolkits/mplot3d/axes3d.py --- a/lib/mpl_toolkits/mplot3d/axes3d.py +++ b/lib/mpl_toolkits/mplot3d/axes3d.py @@ -2249,7 +2249,11 @@ def scatter(self, xs, ys, zs=0, zdir='z', s=20, c=None, depthshade=True, *[np.ravel(np.ma.filled(t, np.nan)) for t in...
diff --git a/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py b/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py --- a/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py +++ b/lib/mpl_toolkits/mplot3d/tests/test_axes3d.py @@ -2226,3 +2226,29 @@ def test_mutating_input_arrays_y_and_z(fig_test, fig_ref): y = [0.0, 0.0, 0.0] ...
[Bug]: ax.scatter (projection='3d') - incorrect handling of NaN ### Bug summary In axis 3D projection NaN values are not handled correctly, apparently the values are masked out (as it should be) but the mask is not applied to a color array that may not have NaN in the same position. ### Code for reproduction ```pyt...
Thank you for your clear report and diagnosis @2sn. I have reproduced this with our `main` development branch. Change this: https://github.com/matplotlib/matplotlib/blob/f017315dd5e56c367e43fc7458fd0ed5fd9482a2/lib/mpl_toolkits/mplot3d/axes3d.py#L2252 to ``` if kwargs.get('color', None): xs, ys, zs, s, c, kw...
2023-07-04T07:17:41Z
3.7
["lib/mpl_toolkits/mplot3d/tests/test_axes3d.py::test_scatter_masked_color"]
["lib/mpl_toolkits/mplot3d/tests/test_axes3d.py::TestVoxels::test_alpha[png]", "lib/mpl_toolkits/mplot3d/tests/test_axes3d.py::TestVoxels::test_calling_conventions", "lib/mpl_toolkits/mplot3d/tests/test_axes3d.py::TestVoxels::test_edge_style[png]", "lib/mpl_toolkits/mplot3d/tests/test_axes3d.py::TestVoxels::test_named_...
0849036fd992a2dd133a0cffc3f84f58ccf1840f
matplotlib/matplotlib
matplotlib__matplotlib-26311
3044bded1b23ae8dc73c1611b124e88db98308ac
diff --git a/lib/matplotlib/contour.py b/lib/matplotlib/contour.py --- a/lib/matplotlib/contour.py +++ b/lib/matplotlib/contour.py @@ -370,7 +370,7 @@ def _split_path_and_get_label_rotation(self, path, idx, screen_pos, lw, spacing= # path always starts with a MOVETO, and we consider there's an implicit ...
diff --git a/lib/matplotlib/tests/test_contour.py b/lib/matplotlib/tests/test_contour.py --- a/lib/matplotlib/tests/test_contour.py +++ b/lib/matplotlib/tests/test_contour.py @@ -1,6 +1,7 @@ import datetime import platform import re +from unittest import mock import contourpy # type: ignore import numpy as np @...
[Bug]: labels can't be placed at start of contours ### Bug summary For some combinations of contour shape and fontsize, the automatic label placement tries to put the label right at the start of the contour. This is not currently possible on `main`. ### Code for reproduction ```python import matplotlib.pyplot as pl...
I left a comment on your commit. Trying to target the end of a broken contour might be easier? > Writing a test seems harder. I tried pasting the above code into a test, and it passed against main. I assume that is because the tests have different "screen space" than when I just run it as a script. Can you set the DP...
2023-07-14T20:39:31Z
3.7
["lib/matplotlib/tests/test_contour.py::test_label_contour_start"]
["lib/matplotlib/tests/test_contour.py::test_algorithm_name[invalid-None]", "lib/matplotlib/tests/test_contour.py::test_algorithm_name[mpl2005-Mpl2005ContourGenerator]", "lib/matplotlib/tests/test_contour.py::test_algorithm_name[mpl2014-Mpl2014ContourGenerator]", "lib/matplotlib/tests/test_contour.py::test_algorithm_na...
0849036fd992a2dd133a0cffc3f84f58ccf1840f
matplotlib/matplotlib
matplotlib__matplotlib-26466
3dd06a46750d174f821df5377996f493f1af4ebb
diff --git a/lib/matplotlib/text.py b/lib/matplotlib/text.py --- a/lib/matplotlib/text.py +++ b/lib/matplotlib/text.py @@ -1389,7 +1389,8 @@ def __init__(self, artist, ref_coord, unit="points"): The screen units to use (pixels or points) for the offset input. """ self._artist = artist - ...
diff --git a/lib/matplotlib/tests/test_text.py b/lib/matplotlib/tests/test_text.py --- a/lib/matplotlib/tests/test_text.py +++ b/lib/matplotlib/tests/test_text.py @@ -16,7 +16,7 @@ import matplotlib.transforms as mtransforms from matplotlib.testing.decorators import check_figures_equal, image_comparison from matplot...
Updating an array passed as the xy parameter to annotate updates the anottation ### Bug report **Bug summary** When an array is used as the _xy_ kwarg for an annotation that includes arrows, changing the array after calling the function changes the arrow position. It is very likely that the same array is kept instead ...
I guess that a simple patch to _AnnotationBase init should work, but I'd check for more places where the a similar bug can be hidden: Maybe changing: https://github.com/matplotlib/matplotlib/blob/89fa0e43b63512c595387a37bdfd37196ced69be/lib/matplotlib/text.py#L1332 for `self.xy=np.array(xy)` is enough. This code works...
2023-08-07T19:30:22Z
3.7
["lib/matplotlib/tests/test_text.py::test_annotate_and_offsetfrom_copy_input[png]"]
["lib/matplotlib/tests/test_text.py::test_afm_kerning", "lib/matplotlib/tests/test_text.py::test_agg_text_clip[png]", "lib/matplotlib/tests/test_text.py::test_alignment[pdf]", "lib/matplotlib/tests/test_text.py::test_alignment[png]", "lib/matplotlib/tests/test_text.py::test_annotate_errors[TypeError-print-xycoords", "l...
0849036fd992a2dd133a0cffc3f84f58ccf1840f
mwaskom/seaborn
mwaskom__seaborn-2389
bcdac5411a1b71ff8d4a2fd12a937c129513e79e
diff --git a/seaborn/matrix.py b/seaborn/matrix.py --- a/seaborn/matrix.py +++ b/seaborn/matrix.py @@ -38,22 +38,15 @@ def _index_to_ticklabels(index): def _convert_colors(colors): """Convert either a list of colors or nested lists of colors to RGB.""" - to_rgb = mpl.colors.colorConverter.to_rgb - - if is...
diff --git a/seaborn/tests/test_matrix.py b/seaborn/tests/test_matrix.py --- a/seaborn/tests/test_matrix.py +++ b/seaborn/tests/test_matrix.py @@ -780,6 +780,26 @@ def test_colors_input(self): assert len(cg.fig.axes) == 6 + def test_categorical_colors_input(self): + kws = self.default_kws.copy() ...
ValueError: fill value must be in categories In the _preprocess_colors function, there is the code to replace na's with background color as the comment said, using `colors = colors.fillna('white')`, however, if the original colors do not contain the 'white' category, this line would raise the Pandas ValueError:fill va...
Can you please share a reproducible example that demonstrates the issue? I can't really figure out what you're talking about from this description. Here's a self-contained example, using ``clustermap()``. This has to do with colors input for row/col colors that are pandas ``category`` dtype: ```python import seaborn as...
2020-12-18T19:35:43Z
0.12
["seaborn/tests/test_matrix.py::TestClustermap::test_categorical_colors_input"]
["seaborn/tests/test_matrix.py::TestClustermap::test_cbar_pos", "seaborn/tests/test_matrix.py::TestClustermap::test_cluster_false", "seaborn/tests/test_matrix.py::TestClustermap::test_cluster_false_row_col_colors", "seaborn/tests/test_matrix.py::TestClustermap::test_clustermap_annotation", "seaborn/tests/test_matrix.py...
d25872b0fc99dbf7e666a91f59bd4ed125186aa1
mwaskom/seaborn
mwaskom__seaborn-2576
430c1bf1fcc690f0431e6fc87b481b7b43776594
diff --git a/seaborn/regression.py b/seaborn/regression.py --- a/seaborn/regression.py +++ b/seaborn/regression.py @@ -419,7 +419,8 @@ def lineplot(self, ax, kws): # Draw the regression line and confidence interval line, = ax.plot(grid, yhat, **kws) - line.sticky_edges.x[:] = edges # Prevent...
diff --git a/seaborn/tests/test_regression.py b/seaborn/tests/test_regression.py --- a/seaborn/tests/test_regression.py +++ b/seaborn/tests/test_regression.py @@ -1,3 +1,4 @@ +from distutils.version import LooseVersion import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt @@ -596,6 +597,44 @@ d...
lmplot(sharey=False) not working The following code behaves as if `sharey=True`. (edit: actually, it does not behave the same, but it is still not rescaling the plots individually the way it should) ``` df=pd.DataFrame({'x':[1,2,3,1,2,3], 'y':[4,5,2,400,500,200], 't':[1,1,1,2,2,2]}) sns.lmplot(data=df, x='x', y='y',...
Worth noting: the y axes are not shared in the "wrong" plot, however the y axis autoscaling is off. My suspicion is that this line is the culprit: https://github.com/mwaskom/seaborn/blob/master/seaborn/regression.py#L611-L616 "the y axes are not shared in the "wrong" plot" You are right, the scales aren't actually id...
2021-05-06T18:35:25Z
0.12
["seaborn/tests/test_regression.py::TestRegressionPlots::test_lmplot_facet_kws", "seaborn/tests/test_regression.py::TestRegressionPlots::test_lmplot_facet_truncate[False]", "seaborn/tests/test_regression.py::TestRegressionPlots::test_lmplot_facet_truncate[True]"]
["seaborn/tests/test_regression.py::TestLinearPlotter::test_dropna", "seaborn/tests/test_regression.py::TestLinearPlotter::test_establish_variables_from_array", "seaborn/tests/test_regression.py::TestLinearPlotter::test_establish_variables_from_bad", "seaborn/tests/test_regression.py::TestLinearPlotter::test_establish_...
d25872b0fc99dbf7e666a91f59bd4ed125186aa1
mwaskom/seaborn
mwaskom__seaborn-2979
ebc4bfe9f8bf5c4ff10b14da8a49c8baa1ba76d0
diff --git a/seaborn/_core/plot.py b/seaborn/_core/plot.py --- a/seaborn/_core/plot.py +++ b/seaborn/_core/plot.py @@ -943,8 +943,11 @@ def _setup_figure(self, p: Plot, common: PlotData, layers: list[Layer]) -> None: visible_side = {"x": "bottom", "y": "left"}.get(axis) show_axis_label...
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 @@ -1538,8 +1538,10 @@ def test_x_wrapping(self, long_df): assert_gridspec_shape(p._figure.axes[0], len(x_vars) // wrap + 1, wrap) assert len(p._figure.axes) == len(x_vars) ...
Visibility of internal axis labels is wrong with wrapped pair plot ```python ( so.Plot(mpg, y="mpg") .pair(["displacement", "weight", "horsepower", "cylinders"], wrap=2) ) ``` ![image](https://user-images.githubusercontent.com/315810/186793170-dedae71a-2cb9-4f0e-9339-07fc1d13ac59.png) The top two subplots shou...
2022-08-26T11:07:57Z
0.12
["tests/_core/test_plot.py::TestPairInterface::test_x_wrapping", "tests/_core/test_plot.py::TestPairInterface::test_y_wrapping", "tests/_core/test_subplots.py::TestSubplotSpec::test_y_paired_and_wrapped_single_row"]
["tests/_core/test_plot.py::TestFacetInterface::test_1d[col]", "tests/_core/test_plot.py::TestFacetInterface::test_1d[row]", "tests/_core/test_plot.py::TestFacetInterface::test_1d_as_vector[col]", "tests/_core/test_plot.py::TestFacetInterface::test_1d_as_vector[row]", "tests/_core/test_plot.py::TestFacetInterface::test...
d25872b0fc99dbf7e666a91f59bd4ed125186aa1
mwaskom/seaborn
mwaskom__seaborn-3217
623b0b723c671e99f04e8ababf19adc563f30168
diff --git a/seaborn/_core/plot.py b/seaborn/_core/plot.py --- a/seaborn/_core/plot.py +++ b/seaborn/_core/plot.py @@ -1377,10 +1377,9 @@ def _unscale_coords( ) -> DataFrame: # TODO do we still have numbers in the variable name at this point? coord_cols = [c for c in df if re.match(r"^[xy]\D*$", ...
diff --git a/tests/_marks/test_bar.py b/tests/_marks/test_bar.py --- a/tests/_marks/test_bar.py +++ b/tests/_marks/test_bar.py @@ -200,3 +200,13 @@ def test_unfilled(self, x, y): colors = p._theme["axes.prop_cycle"].by_key()["color"] assert_array_equal(fcs, to_rgba_array([colors[0]] * len(x), 0)) ...
Width computation after histogram slightly wrong with log scale Note the slight overlap here: ```python ( so.Plot(tips, "total_bill") .add(so.Bars(alpha=.3, edgewidth=0), so.Hist(bins=4)) .scale(x="log") ) ``` ![image](https://user-images.githubusercontent.com/315810/178975852-d8fd830e-ae69-487d-be22-36531...
null
2023-01-10T12:37:28Z
0.13
["tests/_marks/test_bar.py::TestBars::test_log_scale"]
["tests/_marks/test_bar.py::TestBar::test_artist_kws_clip", "tests/_marks/test_bar.py::TestBar::test_categorical_positions_horizontal", "tests/_marks/test_bar.py::TestBar::test_categorical_positions_vertical", "tests/_marks/test_bar.py::TestBar::test_mapped_properties", "tests/_marks/test_bar.py::TestBar::test_numeric_...
23860365816440b050e9211e1c395a966de3c403
pallets/flask
pallets__flask-4045
d8c37f43724cd9fb0870f77877b7c4c7e38a19e0
diff --git a/src/flask/blueprints.py b/src/flask/blueprints.py --- a/src/flask/blueprints.py +++ b/src/flask/blueprints.py @@ -188,6 +188,10 @@ def __init__( template_folder=template_folder, root_path=root_path, ) + + if "." in name: + raise ValueError("'name' may no...
diff --git a/tests/test_basic.py b/tests/test_basic.py --- a/tests/test_basic.py +++ b/tests/test_basic.py @@ -1631,7 +1631,7 @@ def something_else(): def test_inject_blueprint_url_defaults(app): - bp = flask.Blueprint("foo.bar.baz", __name__, template_folder="template") + bp = flask.Blueprint("foo", __name_...
Raise error when blueprint name contains a dot This is required since every dot is now significant since blueprints can be nested. An error was already added for endpoint names in 1.0, but should have been added for this as well.
null
2021-05-13T21:32:41Z
2
["tests/test_blueprints.py::test_dotted_name_not_allowed", "tests/test_blueprints.py::test_route_decorator_custom_endpoint_with_dots"]
["tests/test_basic.py::test_app_freed_on_zero_refcount", "tests/test_basic.py::test_disallow_string_for_allowed_methods", "tests/test_basic.py::test_error_handler_unknown_code", "tests/test_basic.py::test_exception_propagation", "tests/test_basic.py::test_g_iteration_protocol", "tests/test_basic.py::test_get_method_on_...
4346498c85848c53843b810537b83a8f6124c9d3
pallets/flask
pallets__flask-4935
fa1ee7066807c21256e90089731c548b313394d2
diff --git a/src/flask/blueprints.py b/src/flask/blueprints.py --- a/src/flask/blueprints.py +++ b/src/flask/blueprints.py @@ -358,6 +358,9 @@ def register(self, app: "Flask", options: dict) -> None: :param options: Keyword arguments forwarded from :meth:`~Flask.register_blueprint`. + .. ...
diff --git a/tests/test_blueprints.py b/tests/test_blueprints.py --- a/tests/test_blueprints.py +++ b/tests/test_blueprints.py @@ -950,6 +950,55 @@ def index(): assert response.status_code == 200 +def test_nesting_subdomains(app, client) -> None: + subdomain = "api" + parent = flask.Blueprint("parent", _...
Nested blueprints are not respected when mounted on subdomains Hello, and thanks for all your work 🙏🏻 Nested blueprints [as described in the docs](https://flask.palletsprojects.com/en/2.2.x/blueprints/#nesting-blueprints) work perfectly fine when using `url_prefix`. However, when mounting the parent blueprint using...
It looks like if you request `http://localhost:5000/child/`, you'll get 200 OK. It means that when registering child blueprints, they don't respect the subdomain set by the parent. I submitted a PR at #4855.
2023-01-04T16:50:46Z
2.3
["tests/test_blueprints.py::test_child_and_parent_subdomain", "tests/test_blueprints.py::test_nesting_subdomains"]
["tests/test_blueprints.py::test_add_template_filter", "tests/test_blueprints.py::test_add_template_filter_with_name", "tests/test_blueprints.py::test_add_template_test", "tests/test_blueprints.py::test_add_template_test_with_name", "tests/test_blueprints.py::test_dotted_name_not_allowed", "tests/test_blueprints.py::te...
182ce3dd15dfa3537391c3efaf9c3ff407d134d4
pallets/flask
pallets__flask-5014
7ee9ceb71e868944a46e1ff00b506772a53a4f1d
diff --git a/src/flask/blueprints.py b/src/flask/blueprints.py --- a/src/flask/blueprints.py +++ b/src/flask/blueprints.py @@ -190,6 +190,9 @@ def __init__( root_path=root_path, ) + if not name: + raise ValueError("'name' may not be empty.") + if "." in name: ...
diff --git a/tests/test_blueprints.py b/tests/test_blueprints.py --- a/tests/test_blueprints.py +++ b/tests/test_blueprints.py @@ -256,6 +256,11 @@ def test_dotted_name_not_allowed(app, client): flask.Blueprint("app.ui", __name__) +def test_empty_name_not_allowed(app, client): + with pytest.raises(Value...
Require a non-empty name for Blueprints Things do not work correctly if a Blueprint is given an empty name (e.g. #4944). It would be helpful if a `ValueError` was raised when trying to do that.
null
2023-03-04T18:36:21Z
2.3
["tests/test_blueprints.py::test_empty_name_not_allowed"]
["tests/test_blueprints.py::test_add_template_filter", "tests/test_blueprints.py::test_add_template_filter_with_name", "tests/test_blueprints.py::test_add_template_filter_with_name_and_template", "tests/test_blueprints.py::test_add_template_filter_with_template", "tests/test_blueprints.py::test_add_template_test", "tes...
182ce3dd15dfa3537391c3efaf9c3ff407d134d4
psf/requests
psf__requests-1537
d8268fb7b44da7b8aa225eb1ca6fbdb4f9dc2457
diff --git a/requests/models.py b/requests/models.py --- a/requests/models.py +++ b/requests/models.py @@ -106,6 +106,10 @@ def _encode_files(files, data): val = [val] for v in val: if v is not None: + # Don't call str() on bytestrings: in Py3 it all goe...
diff --git a/test_requests.py b/test_requests.py --- a/test_requests.py +++ b/test_requests.py @@ -663,6 +663,14 @@ def test_header_keys_are_native(self): self.assertTrue('unicode' in p.headers.keys()) self.assertTrue('byte' in p.headers.keys()) + def test_can_send_nonstring_objects_with_files(se...
multipart/form-data and datetime data I raise an bug that you already fix in the past on this issue : https://github.com/kennethreitz/requests/issues/661 or https://github.com/kennethreitz/requests/issues/737 I tried the same methodology with that code : ``` import requets requests.post("http://httpbin.org/post", da...
Hi @ppavril, thanks for raising this issue! So the problem here is that we don't ask for a string representation of keys or values. I think the correct fix is changing the following code (at [line 102 of models.py](https://github.com/kennethreitz/requests/blob/master/requests/models.py#L102)) from: ``` python for fie...
2013-08-17T06:29:06Z
1.2
["test_requests.py::RequestsTestCase::test_can_send_nonstring_objects_with_files"]
["test_requests.py::RequestsTestCase::test_basic_building", "test_requests.py::RequestsTestCase::test_cannot_send_unprepared_requests", "test_requests.py::RequestsTestCase::test_cookie_parameters", "test_requests.py::RequestsTestCase::test_entry_points", "test_requests.py::RequestsTestCase::test_get_auth_from_url", "te...
d8268fb7b44da7b8aa225eb1ca6fbdb4f9dc2457
psf/requests
psf__requests-1635
9968a10fcfad7268b552808c4f8946eecafc956a
diff --git a/requests/cookies.py b/requests/cookies.py --- a/requests/cookies.py +++ b/requests/cookies.py @@ -392,15 +392,21 @@ def morsel_to_cookie(morsel): return c -def cookiejar_from_dict(cookie_dict, cookiejar=None): +def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True): """Returns a...
diff --git a/test_requests.py b/test_requests.py --- a/test_requests.py +++ b/test_requests.py @@ -164,6 +164,12 @@ def test_cookie_quote_wrapped(self): s.get(httpbin('cookies/set?foo="bar:baz"')) self.assertTrue(s.cookies['foo'] == '"bar:baz"') + def test_cookie_persists_via_api(self): + ...
Cookies not persisted when set via functional API. Cookies set as part of a call to `Session.request()` (or any of the top level methods that call it) are _not_ persisted, including on redirects. Expected behaviour: ``` python >>> s = requests.Session() >>> r = s.get('http://httpbin.org/redirect/1', cookies={'Hi': 'T...
null
2013-09-28T14:50:12Z
2
["test_requests.py::RequestsTestCase::test_cookie_persists_via_api"]
["test_requests.py::RequestsTestCase::test_BASICAUTH_TUPLE_HTTP_200_OK_GET", "test_requests.py::RequestsTestCase::test_DIGESTAUTH_WRONG_HTTP_401_GET", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_RETURNS_COOKIE", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_SETS_SESSION_COOKIES", "test_requests.py::Re...
4bceb312f1b99d36a25f2985b5606e98b6f0d8cd
psf/requests
psf__requests-1657
43477edc91a8f49de1e9d96117f9cc6d087e71d9
diff --git a/requests/sessions.py b/requests/sessions.py --- a/requests/sessions.py +++ b/requests/sessions.py @@ -65,6 +65,22 @@ def merge_setting(request_setting, session_setting, dict_class=OrderedDict): return merged_setting +def merge_hooks(request_hooks, session_hooks, dict_class=OrderedDict): + """ +...
diff --git a/test_requests.py b/test_requests.py --- a/test_requests.py +++ b/test_requests.py @@ -449,6 +449,25 @@ def hook(resp, **kwargs): requests.Request('GET', HTTPBIN, hooks={'response': hook}) + def test_session_hooks_are_used_with_no_request_hooks(self): + hook = lambda x, *args, **kwarg...
Session hooks broken Request hooks are being [merged](https://github.com/kennethreitz/requests/blob/master/requests/sessions.py#L264) with session hooks; since both hook dicts have a list as the value, one simply overwrites the other.
Great spot, thanks! We should improve our merging logic here. I might take a crack at this in an hour or so Hm. This has always been the behaviour of how per-request hooks work with session hooks but it isn't exactly intuitive. My concern is whether people are relying on this behaviour since the logic in `merge_setti...
2013-10-08T00:23:48Z
2
["test_requests.py::RequestsTestCase::test_prepared_from_session", "test_requests.py::RequestsTestCase::test_request_cookie_overrides_session_cookie", "test_requests.py::RequestsTestCase::test_session_hooks_are_used_with_no_request_hooks"]
["test_requests.py::RequestsTestCase::test_BASICAUTH_TUPLE_HTTP_200_OK_GET", "test_requests.py::RequestsTestCase::test_DIGESTAUTH_WRONG_HTTP_401_GET", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_RETURNS_COOKIE", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_SETS_SESSION_COOKIES", "test_requests.py::Re...
4bceb312f1b99d36a25f2985b5606e98b6f0d8cd
psf/requests
psf__requests-1689
e91ee0e2461cc9b6822e7c3cc422038604ace08d
diff --git a/requests/models.py b/requests/models.py --- a/requests/models.py +++ b/requests/models.py @@ -407,7 +407,7 @@ def prepare_body(self, data, files): raise NotImplementedError('Streamed bodies and files are mutually exclusive.') if length is not None: - self.head...
diff --git a/test_requests.py b/test_requests.py --- a/test_requests.py +++ b/test_requests.py @@ -684,6 +684,14 @@ def test_can_send_nonstring_objects_with_files(self): self.assertTrue('multipart/form-data' in p.headers['Content-Type']) + def test_autoset_header_values_are_native(self): + data =...
Problem POST'ing png file because of UnicodeError Here is the code I'm using: ``` python files = {'file': (upload_handle.upload_token.key, open("test.png", "rb"))} resp = requests.post(url, files=files) ``` This raises the error: ``` UnicodeDecodeError: 'utf8' codec can't decode byte 0x89 in position 140: invalid st...
Yep, that's a crass little bug. Thanks so much for pointing it out! I'll go through the headers we set and make sure we don't do this anywhere else. =)
2013-10-18T17:35:07Z
2
["test_requests.py::RequestsTestCase::test_HTTP_200_OK_HEAD", "test_requests.py::RequestsTestCase::test_user_agent_transfers"]
["test_requests.py::RequestsTestCase::test_BASICAUTH_TUPLE_HTTP_200_OK_GET", "test_requests.py::RequestsTestCase::test_DIGESTAUTH_WRONG_HTTP_401_GET", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_RETURNS_COOKIE", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_SETS_SESSION_COOKIES", "test_requests.py::Re...
4bceb312f1b99d36a25f2985b5606e98b6f0d8cd
psf/requests
psf__requests-1713
340b2459031feb421d678c3c75865c3b11c07938
diff --git a/requests/cookies.py b/requests/cookies.py --- a/requests/cookies.py +++ b/requests/cookies.py @@ -421,3 +421,25 @@ def cookiejar_from_dict(cookie_dict, cookiejar=None, overwrite=True): cookiejar.set_cookie(create_cookie(name, cookie_dict[name])) return cookiejar + + +def merge_cooki...
diff --git a/test_requests.py b/test_requests.py --- a/test_requests.py +++ b/test_requests.py @@ -187,6 +187,14 @@ def test_generic_cookiejar_works(self): assert r.json()['cookies']['foo'] == 'bar' # Make sure the session cj is still the custom one assert s.cookies is cj + + def test_...
Regression 2.0.1: Using MozillaCookieJar does not work Could not find an issue raised for this, not sure if this was an expected change either. This is reproducible on master. Existing code fails on update to `requests-2.0.1`. The cause seems to be triggered by the change at https://github.com/kennethreitz/requests/co...
Mm, good spot. I think we should try to do something smarter here. Thanks for raising this issue! :cake:
2013-10-29T14:49:12Z
2
["test_requests.py::RequestsTestCase::test_BASICAUTH_TUPLE_HTTP_200_OK_GET", "test_requests.py::RequestsTestCase::test_HTTP_302_ALLOW_REDIRECT_GET", "test_requests.py::RequestsTestCase::test_POSTBIN_GET_POST_FILES", "test_requests.py::RequestsTestCase::test_param_cookiejar_works", "test_requests.py::RequestsTestCase::t...
["test_requests.py::RequestsTestCase::test_DIGESTAUTH_WRONG_HTTP_401_GET", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_RETURNS_COOKIE", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_SETS_SESSION_COOKIES", "test_requests.py::RequestsTestCase::test_DIGEST_HTTP_200_OK_GET", "test_requests.py::RequestsTes...
4bceb312f1b99d36a25f2985b5606e98b6f0d8cd
psf/requests
psf__requests-1776
4bceb312f1b99d36a25f2985b5606e98b6f0d8cd
diff --git a/requests/auth.py b/requests/auth.py --- a/requests/auth.py +++ b/requests/auth.py @@ -16,6 +16,7 @@ from base64 import b64encode from .compat import urlparse, str +from .cookies import extract_cookies_to_jar from .utils import parse_dict_header log = logging.getLogger(__name__) @@ -169,7 +170,8 @@ ...
diff --git a/test_requests.py b/test_requests.py --- a/test_requests.py +++ b/test_requests.py @@ -165,7 +165,7 @@ def test_cookie_quote_wrapped(self): def test_cookie_persists_via_api(self): s = requests.session() - r = s.get(httpbin('redirect/1'), cookies={'foo':'bar'}) + r = s.get(httpb...
Request cookies should not be persisted to session After the fix for #1630, cookies sent with a request are now incorrectly persisted to the session. Specifically, problem lies here: https://github.com/kennethreitz/requests/blob/1511dfa637643bae5b6111a20ecb80ec9ae26032/requests/sessions.py#L330 Removing that breaks t...
null
2013-12-04T12:46:50Z
2
["test_requests.py::RequestsTestCase::test_DIGEST_AUTH_SETS_SESSION_COOKIES", "test_requests.py::RequestsTestCase::test_request_cookies_not_persisted", "test_requests.py::RequestsTestCase::test_set_cookie_on_301", "test_requests.py::RequestsTestCase::test_user_agent_transfers"]
["test_requests.py::RequestsTestCase::test_DIGESTAUTH_QUOTES_QOP_VALUE", "test_requests.py::RequestsTestCase::test_DIGEST_STREAM", "test_requests.py::RequestsTestCase::test_HTTP_200_OK_GET_WITH_MIXED_PARAMS", "test_requests.py::RequestsTestCase::test_HTTP_200_OK_HEAD", "test_requests.py::RequestsTestCase::test_HTTP_200...
4bceb312f1b99d36a25f2985b5606e98b6f0d8cd
psf/requests
psf__requests-2617
636b946af5eac8ba4cffa63a727523cd8c2c01ab
diff --git a/requests/models.py b/requests/models.py --- a/requests/models.py +++ b/requests/models.py @@ -328,8 +328,9 @@ def copy(self): def prepare_method(self, method): """Prepares the given HTTP method.""" self.method = method - if self.method is not None: - self.method = s...
diff --git a/test_requests.py b/test_requests.py --- a/test_requests.py +++ b/test_requests.py @@ -89,7 +89,7 @@ def test_invalid_url(self): requests.get('http://') def test_basic_building(self): - req = requests.Request() + req = requests.Request(method='GET') req.url = 'http...
Prepared requests containing binary files will not send when unicode_literals is imported ``` python #!/usr/bin/env python from __future__ import unicode_literals...
Unfortunately this is a bit of a limitation imposed on us by httplib. As you can see, the place where unicode and bytes are concatenated together is actually deep inside httplib. I'm afraid you'll have to pass bytestrings to requests. Can you explain why it works fine when the request isn't prepared? That seems incons...
2015-05-28T17:09:51Z
2.7
["test_requests.py::RequestsTestCase::test_BASICAUTH_TUPLE_HTTP_200_OK_GET", "test_requests.py::RequestsTestCase::test_DIGESTAUTH_WRONG_HTTP_401_GET", "test_requests.py::RequestsTestCase::test_HTTP_200_OK_GET_WITH_PARAMS", "test_requests.py::RequestsTestCase::test_POSTBIN_GET_POST_FILES_WITH_DATA", "test_requests.py::R...
["test_requests.py::RequestsTestCase::test_DIGESTAUTH_QUOTES_QOP_VALUE", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_RETURNS_COOKIE", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_SETS_SESSION_COOKIES", "test_requests.py::RequestsTestCase::test_DIGEST_HTTP_200_OK_GET", "test_requests.py::RequestsTestC...
bf436ea0a49513bd4e49bb2d1645bd770e470d75
psf/requests
psf__requests-2674
0be38a0c37c59c4b66ce908731da15b401655113
diff --git a/requests/adapters.py b/requests/adapters.py --- a/requests/adapters.py +++ b/requests/adapters.py @@ -19,6 +19,7 @@ from .utils import (DEFAULT_CA_BUNDLE_PATH, get_encoding_from_headers, prepend_scheme_if_needed, get_auth_from_url, urldefragauth) from .structures import CaseInsensiti...
diff --git a/test_requests.py b/test_requests.py --- a/test_requests.py +++ b/test_requests.py @@ -1655,6 +1655,16 @@ def test_urllib3_retries(): with pytest.raises(RetryError): s.get(httpbin('status/500')) + +def test_urllib3_pool_connection_closed(): + s = requests.Session() + s.mount('http://',...
urllib3 exceptions passing through requests API I don't know if it's a design goal of requests to hide urllib3's exceptions and wrap them around requests.exceptions types. (If it's not IMHO it should be, but that's another discussion) If it is, I have at least two of them passing through that I have to catch in addit...
I definitely agree with you and would agree that these should be wrapped. Could you give us stack-traces so we can find where they're bleeding through? Sorry I don't have stack traces readily available :/ No worries. I have ideas as to where the DecodeError might be coming from but I'm not certain where the TimeoutE...
2015-07-17T08:33:52Z
2.7
["test_requests.py::RequestsTestCase::test_BASICAUTH_TUPLE_HTTP_200_OK_GET", "test_requests.py::RequestsTestCase::test_HTTP_200_OK_GET_ALTERNATIVE", "test_requests.py::RequestsTestCase::test_HTTP_200_OK_GET_WITH_PARAMS", "test_requests.py::RequestsTestCase::test_HTTP_200_OK_HEAD", "test_requests.py::RequestsTestCase::t...
["test_requests.py::RequestsTestCase::test_DIGESTAUTH_QUOTES_QOP_VALUE", "test_requests.py::RequestsTestCase::test_DIGEST_AUTH_SETS_SESSION_COOKIES", "test_requests.py::RequestsTestCase::test_DIGEST_STREAM", "test_requests.py::RequestsTestCase::test_HTTP_200_OK_GET_WITH_MIXED_PARAMS", "test_requests.py::RequestsTestCas...
bf436ea0a49513bd4e49bb2d1645bd770e470d75
psf/requests
psf__requests-6028
0192aac24123735b3eaf9b08df46429bb770c283
diff --git a/requests/utils.py b/requests/utils.py --- a/requests/utils.py +++ b/requests/utils.py @@ -974,6 +974,10 @@ def prepend_scheme_if_needed(url, new_scheme): if not netloc: netloc, path = path, netloc + if auth: + # parse_url doesn't provide the netloc with auth + # so we'll ad...
diff --git a/tests/test_utils.py b/tests/test_utils.py --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -602,6 +602,14 @@ def test_parse_header_links(value, expected): ('example.com/path', 'http://example.com/path'), ('//example.com/path', 'http://example.com/path'), ('example.com:80', ...
Proxy authentication bug <!-- Summary. --> When using proxies in python 3.8.12, I get an error 407. Using any other version of python works fine. I am assuming it could be to do with this https://docs.python.org/3/whatsnew/3.8.html#notable-changes-in-python-3-8-12. <!-- What you expected. --> I should get a status o...
Hi @flameaway, it’s hard to tell what exactly is happening here without more info. Could you verify this issue occurs in both Requests 2.26.0 and urllib3 1.25.11? It could very well be related to the ipaddress change, I’d just like to rule out other potential factors before we start down that path. Requests 2.26.0 ret...
2022-01-04T15:32:52Z
2.27
["tests/test_utils.py::test_prepend_scheme_if_needed[http://user:pass@example.com/path?query-http://user:pass@example.com/path?query]", "tests/test_utils.py::test_prepend_scheme_if_needed[http://user@example.com/path?query-http://user@example.com/path?query]"]
["tests/test_utils.py::TestAddressInNetwork::test_invalid", "tests/test_utils.py::TestAddressInNetwork::test_valid", "tests/test_utils.py::TestContentEncodingDetection::test_none", "tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<?xml", "tests/test_utils.py::TestContentEncodingDetection::test_pragmas[<...
0192aac24123735b3eaf9b08df46429bb770c283
pydata/xarray
pydata__xarray-3239
e90e8bc06cf8e7c97c7dc4c0e8ff1bf87c49faf6
diff --git a/xarray/backends/api.py b/xarray/backends/api.py --- a/xarray/backends/api.py +++ b/xarray/backends/api.py @@ -761,7 +761,7 @@ def open_mfdataset( `xarray.auto_combine` is used, but in the future this behavior will switch to use `xarray.combine_by_coords` by default. compat : {'ident...
diff --git a/xarray/tests/test_combine.py b/xarray/tests/test_combine.py --- a/xarray/tests/test_combine.py +++ b/xarray/tests/test_combine.py @@ -327,13 +327,13 @@ class TestCheckShapeTileIDs: def test_check_depths(self): ds = create_test_data(0) combined_tile_ids = {(0,): ds, (0, 1): ds} - ...
We need a fast path for open_mfdataset It would be great to have a "fast path" option for `open_mfdataset`, in which all alignment / coordinate checking is bypassed. This would be used in cases where the user knows that many netCDF files all share the same coordinates (e.g. model output, satellite records from the same...
@rabernat - Depending on the structure of the dataset, another possibility that would speed up some `open_mfdataset` tasks substantially is to implement the step of opening each file and getting its metadata in in some parallel way (dask/joblib/etc.) and either returning the just dataset schema or a picklable version o...
2019-08-22T15:29:57Z
0.12
["xarray/tests/test_combine.py::TestAutoCombineOldAPI::test_auto_combine", "xarray/tests/test_concat.py::TestConcatDataset::test_concat_constant_index", "xarray/tests/test_concat.py::TestConcatDataset::test_concat_coords", "xarray/tests/test_concat.py::TestConcatDataset::test_concat_errors", "xarray/tests/test_concat.p...
["xarray/tests/test_combine.py::TestAutoCombineDeprecation::test_auto_combine_with_concat_dim", "xarray/tests/test_combine.py::TestAutoCombineDeprecation::test_auto_combine_with_coords", "xarray/tests/test_combine.py::TestAutoCombineDeprecation::test_auto_combine_with_merge_and_concat", "xarray/tests/test_combine.py::T...
1c198a191127c601d091213c4b3292a8bb3054e1
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 here ...
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_align_dtype", "xarray/tests/test_dataarray.py::TestDataArray::test_align_indexes", "xarray/tests/test_dataarray.py::TestDataArray::test_align_mixed_indexes", "xarray/tests/test_dataarray.py::TestDataArray::test_align_override", "xarray/tests/test_dataarray.py::TestD...
1c198a191127c601d091213c4b3292a8bb3054e1
pydata/xarray
pydata__xarray-3635
f2b2f9f62ea0f1020262a7ff563bfe74258ffaa1
diff --git a/xarray/core/variable.py b/xarray/core/variable.py --- a/xarray/core/variable.py +++ b/xarray/core/variable.py @@ -1731,6 +1731,10 @@ def quantile(self, q, dim=None, interpolation="linear", keep_attrs=None): scalar = utils.is_scalar(q) q = np.atleast_1d(np.asarray(q, dtype=np.float64)) +...
diff --git a/xarray/tests/test_variable.py b/xarray/tests/test_variable.py --- a/xarray/tests/test_variable.py +++ b/xarray/tests/test_variable.py @@ -1542,6 +1542,14 @@ def test_quantile_chunked_dim_error(self): with raises_regex(ValueError, "dimension 'x'"): v.quantile(0.5, dim="x") + @pyte...
"ValueError: Percentiles must be in the range [0, 100]" #### 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 import x...
Looks straightforward - could you open a PR?
2019-12-17T13:16:40Z
0.12
["xarray/tests/test_variable.py::TestVariable::test_quantile_out_of_bounds[-0.1]", "xarray/tests/test_variable.py::TestVariable::test_quantile_out_of_bounds[1.1]", "xarray/tests/test_variable.py::TestVariable::test_quantile_out_of_bounds[q2]", "xarray/tests/test_variable.py::TestVariable::test_quantile_out_of_bounds[q3...
["xarray/tests/test_variable.py::TestAsCompatibleData::test_converted_types", "xarray/tests/test_variable.py::TestAsCompatibleData::test_datetime", "xarray/tests/test_variable.py::TestAsCompatibleData::test_full_like", "xarray/tests/test_variable.py::TestAsCompatibleData::test_masked_array", "xarray/tests/test_variable...
1c198a191127c601d091213c4b3292a8bb3054e1
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') expec...
null
2020-01-09T16:07:14Z
0.12
["xarray/tests/test_merge.py::TestMergeMethod::test_merge_dataarray"]
["xarray/tests/test_merge.py::TestMergeFunction::test_merge_alignment_error", "xarray/tests/test_merge.py::TestMergeFunction::test_merge_arrays", "xarray/tests/test_merge.py::TestMergeFunction::test_merge_dataarray_unnamed", "xarray/tests/test_merge.py::TestMergeFunction::test_merge_datasets", "xarray/tests/test_merge....
1c198a191127c601d091213c4b3292a8bb3054e1
pydata/xarray
pydata__xarray-3733
009aa66620b3437cf0de675013fa7d1ff231963c
diff --git a/xarray/__init__.py b/xarray/__init__.py --- a/xarray/__init__.py +++ b/xarray/__init__.py @@ -17,7 +17,7 @@ from .core.alignment import align, broadcast from .core.combine import auto_combine, combine_by_coords, combine_nested from .core.common import ALL_DIMS, full_like, ones_like, zeros_like -from .co...
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 @@ -1120,3 +1120,35 @@ def test_where(): actual = xr.where(cond, 1, 0) expected = xr.DataArray([1, 0], dims="x") assert_identical(expected, actual...
Implement polyfit? Fitting a line (or curve) to data along a specified axis is a long-standing need of xarray users. There are many blog posts and SO questions about how to do it: - http://atedstone.github.io/rate-of-change-maps/ - https://gist.github.com/luke-gregor/4bb5c483b2d111e52413b260311fbe43 - https://stackover...
dask has `lstsq` https://docs.dask.org/en/latest/array-api.html#dask.array.linalg.lstsq . Would that avoid the dimension-must-have-one-chunk issue? EDIT: I am in favour of adding this. It's a common use case like `differentiate` and `integrate` I am in favour of adding this (and other common functionality), but I woul...
2020-01-30T16:58:51Z
0.12
["xarray/tests/test_computation.py::test_broadcast_compat_data_1d", "xarray/tests/test_computation.py::test_broadcast_compat_data_2d", "xarray/tests/test_computation.py::test_collect_dict_values", "xarray/tests/test_computation.py::test_dot[False]", "xarray/tests/test_computation.py::test_join_dict_keys", "xarray/tests...
[]
1c198a191127c601d091213c4b3292a8bb3054e1
pydata/xarray
pydata__xarray-3812
8512b7bf498c0c300f146447c0b05545842e9404
diff --git a/xarray/core/options.py b/xarray/core/options.py --- a/xarray/core/options.py +++ b/xarray/core/options.py @@ -20,7 +20,7 @@ CMAP_SEQUENTIAL: "viridis", CMAP_DIVERGENT: "RdBu_r", KEEP_ATTRS: "default", - DISPLAY_STYLE: "text", + DISPLAY_STYLE: "html", } _JOIN_OPTIONS = frozenset(["i...
diff --git a/xarray/tests/test_options.py b/xarray/tests/test_options.py --- a/xarray/tests/test_options.py +++ b/xarray/tests/test_options.py @@ -68,12 +68,12 @@ def test_nested_options(): def test_display_style(): - original = "text" + original = "html" assert OPTIONS["display_style"] == original ...
Turn on _repr_html_ by default? I just wanted to open this to discuss turning the _repr_html_ on by default. This PR https://github.com/pydata/xarray/pull/3425 added it as a style option, but I suspect that more people will use if it is on by default. Does that seem like a reasonable change?
Yes from me! I still think it's worth keeping the option though +1! I'm too often too lazy to turn it on, what a shame! And also +1 for keeping the option. +1
2020-02-28T21:12:43Z
0.12
["xarray/tests/test_options.py::test_display_style"]
["xarray/tests/test_options.py::TestAttrRetention::test_concat_attr_retention", "xarray/tests/test_options.py::TestAttrRetention::test_dataarray_attr_retention", "xarray/tests/test_options.py::TestAttrRetention::test_dataset_attr_retention", "xarray/tests/test_options.py::TestAttrRetention::test_groupby_attr_retention"...
1c198a191127c601d091213c4b3292a8bb3054e1
pydata/xarray
pydata__xarray-4184
65ca92a5c0a4143d00dd7a822bcb1d49738717f1
diff --git a/asv_bench/benchmarks/pandas.py b/asv_bench/benchmarks/pandas.py new file mode 100644 --- /dev/null +++ b/asv_bench/benchmarks/pandas.py @@ -0,0 +1,24 @@ +import numpy as np +import pandas as pd + +from . import parameterized + + +class MultiIndexSeries: + def setup(self, dtype, subset): + data = ...
diff --git a/xarray/tests/test_dataset.py b/xarray/tests/test_dataset.py --- a/xarray/tests/test_dataset.py +++ b/xarray/tests/test_dataset.py @@ -4013,6 +4013,49 @@ def test_to_and_from_empty_dataframe(self): assert len(actual) == 0 assert expected.equals(actual) + def test_from_dataframe_multii...
Stack + to_array before to_xarray is much faster that a simple to_xarray I was seeing some slow performance around `to_xarray()` on MultiIndexed series, and found that unstacking one of the dimensions before running `to_xarray()`, and then restacking with `to_array()` was ~30x faster. This time difference is consistent...
Here are the top entries I see with `%prun cropped.to_xarray()`: ``` 308597 function calls (308454 primitive calls) in 0.651 seconds Ordered by: internal time ncalls tottime percall cumtime percall filename:lineno(function) 100000 0.255 0.000 0.275 0.000 datetimes.py:606(<lambda>) ...
2020-06-26T07:39:14Z
0.12
["xarray/tests/test_dataset.py::TestDataset::test_from_dataframe_multiindex", "xarray/tests/test_dataset.py::TestDataset::test_from_dataframe_unsorted_levels"]
["xarray/tests/test_dataset.py::TestDataset::test_align_exact", "xarray/tests/test_dataset.py::TestDataset::test_align_indexes", "xarray/tests/test_dataset.py::TestDataset::test_align_override", "xarray/tests/test_dataset.py::TestDataset::test_apply_pending_deprecated_map", "xarray/tests/test_dataset.py::TestDataset::t...
1c198a191127c601d091213c4b3292a8bb3054e1
pydata/xarray
pydata__xarray-4248
98dc1f4ea18738492e074e9e51ddfed5cd30ab94
diff --git a/xarray/core/formatting.py b/xarray/core/formatting.py --- a/xarray/core/formatting.py +++ b/xarray/core/formatting.py @@ -261,6 +261,8 @@ def inline_variable_array_repr(var, max_width): return inline_dask_repr(var.data) elif isinstance(var._data, sparse_array_type): return inline_spa...
diff --git a/xarray/tests/test_formatting.py b/xarray/tests/test_formatting.py --- a/xarray/tests/test_formatting.py +++ b/xarray/tests/test_formatting.py @@ -7,6 +7,7 @@ import xarray as xr from xarray.core import formatting +from xarray.core.npcompat import IS_NEP18_ACTIVE from . import raises_regex @@ -391,...
Feature request: show units in dataset overview Here's a hypothetical dataset: ``` <xarray.Dataset> Dimensions: (time: 3, x: 988, y: 822) Coordinates: * x (x) float64 ... * y (y) float64 ... * time (time) datetime64[ns] ... Data variables: rainfall (time, y, x) float32 ... max_temp...
I would love to see this. What would we want the exact formatting to be? Square brackets to copy how units from `attrs['units']` are displayed on plots? e.g. ``` <xarray.Dataset> Dimensions: (time: 3, x: 988, y: 822) Coordinates: * x [m] (x) float64 ... * y [m] (y) fl...
2020-07-22T14:54:03Z
0.12
["xarray/tests/test_formatting.py::test_inline_variable_array_repr_custom_repr"]
["xarray/tests/test_formatting.py::TestFormatting::test_array_repr", "xarray/tests/test_formatting.py::TestFormatting::test_attribute_repr", "xarray/tests/test_formatting.py::TestFormatting::test_diff_array_repr", "xarray/tests/test_formatting.py::TestFormatting::test_diff_attrs_repr_with_array", "xarray/tests/test_for...
1c198a191127c601d091213c4b3292a8bb3054e1
pydata/xarray
pydata__xarray-4339
3b5a8ee46be7fd00d7ea9093d1941cb6c3be191c
diff --git a/xarray/core/accessor_str.py b/xarray/core/accessor_str.py --- a/xarray/core/accessor_str.py +++ b/xarray/core/accessor_str.py @@ -90,7 +90,7 @@ def _apply(self, f, dtype=None): def len(self): """ - Compute the length of each element in the array. + Compute the length of each s...
diff --git a/xarray/tests/test_accessor_str.py b/xarray/tests/test_accessor_str.py --- a/xarray/tests/test_accessor_str.py +++ b/xarray/tests/test_accessor_str.py @@ -596,7 +596,7 @@ def test_wrap(): ) # expected values - xp = xr.DataArray( + expected = xr.DataArray( [ "hello wor...
missing parameter in DataArray.str.get While working on #4286 I noticed that the docstring of `DataArray.str.get` claims to allow passing a default value in addition to the index, but the python code doesn't have that parameter at all. I think the default value is a good idea and that we should make the code match the ...
Similarly `str.wrap` does not pass on its `kwargs` https://github.com/pydata/xarray/blob/7daad4fce3bf8ad9b9bc8e7baa104c476437e68d/xarray/core/accessor_str.py#L654
2020-08-14T14:09:56Z
0.12
["xarray/tests/test_accessor_str.py::test_get_default[bytes_]", "xarray/tests/test_accessor_str.py::test_get_default[str_]", "xarray/tests/test_accessor_str.py::test_wrap_kwargs_passed"]
["xarray/tests/test_accessor_str.py::test_case[bytes_]", "xarray/tests/test_accessor_str.py::test_case[str_]", "xarray/tests/test_accessor_str.py::test_center_ljust_rjust[bytes_]", "xarray/tests/test_accessor_str.py::test_center_ljust_rjust[str_]", "xarray/tests/test_accessor_str.py::test_center_ljust_rjust_fillchar[by...
1c198a191127c601d091213c4b3292a8bb3054e1
pydata/xarray
pydata__xarray-4419
2ed6d57fa5e14e87e83c8194e619538f6edcd90a
diff --git a/xarray/core/concat.py b/xarray/core/concat.py --- a/xarray/core/concat.py +++ b/xarray/core/concat.py @@ -463,6 +463,9 @@ def ensure_common_dims(vars): combined = concat_vars(vars, dim, positions) assert isinstance(combined, Variable) result_vars[k] = combined + ...
diff --git a/xarray/tests/test_concat.py b/xarray/tests/test_concat.py --- a/xarray/tests/test_concat.py +++ b/xarray/tests/test_concat.py @@ -558,3 +558,36 @@ def test_concat_merge_single_non_dim_coord(): for coords in ["different", "all"]: with raises_regex(ValueError, "'y' not present in all datasets")...
concat changes variable order #### Code Sample, a copy-pastable example if possible A "Minimal, Complete and Verifiable Example" will make it much easier for maintainers to help you: http://matthewrocklin.com/blog/work/2018/02/28/minimal-bug-reports - Case 1: Creation of Dataset without Coordinates ```python data = ...
Xref: [Gitter Chat](https://gitter.im/pydata/xarray?at=5c88ef25d3b35423cbb02afc) This has also implications for the output using `.to_netcdf()`. If we read a netcdf dataset (same structure as above) with `xr.open_dataset` and then do the above `xr.concat` and save the resulting dataset with `.to_netcdf` then the dimens...
2020-09-14T07:13:33Z
0.12
["xarray/tests/test_concat.py::test_concat_preserve_coordinate_order"]
["xarray/tests/test_concat.py::TestConcatDataArray::test_concat_combine_attrs_kwarg", "xarray/tests/test_concat.py::TestConcatDataArray::test_concat_encoding", "xarray/tests/test_concat.py::TestConcatDataset::test_concat", "xarray/tests/test_concat.py::TestConcatDataset::test_concat_combine_attrs_kwarg", "xarray/tests/...
1c198a191127c601d091213c4b3292a8bb3054e1
pydata/xarray
pydata__xarray-4629
a41edc7bf5302f2ea327943c0c48c532b12009bc
diff --git a/xarray/core/merge.py b/xarray/core/merge.py --- a/xarray/core/merge.py +++ b/xarray/core/merge.py @@ -501,7 +501,7 @@ def merge_attrs(variable_attrs, combine_attrs): if combine_attrs == "drop": return {} elif combine_attrs == "override": - return variable_attrs[0] + return ...
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 @@ -109,6 +109,13 @@ def test_merge_arrays_attrs( expected.attrs = expected_attrs assert actual.identical(expected) + def test_merge_attrs_override_copy(s...
merge(combine_attrs='override') does not copy attrs but instead references attrs from the first object <!-- 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 Repo...
null
2020-11-30T23:06:17Z
0.12
["xarray/tests/test_merge.py::TestMergeFunction::test_merge_attrs_override_copy"]
["xarray/tests/test_merge.py::TestMergeFunction::test_merge_alignment_error", "xarray/tests/test_merge.py::TestMergeFunction::test_merge_arrays", "xarray/tests/test_merge.py::TestMergeFunction::test_merge_arrays_attrs[drop-var1_attrs4-var2_attrs4-expected_attrs4-False]", "xarray/tests/test_merge.py::TestMergeFunction::...
1c198a191127c601d091213c4b3292a8bb3054e1
pydata/xarray
pydata__xarray-4684
0f1eb96c924bad60ea87edd9139325adabfefa33
diff --git a/xarray/coding/times.py b/xarray/coding/times.py --- a/xarray/coding/times.py +++ b/xarray/coding/times.py @@ -26,6 +26,7 @@ _STANDARD_CALENDARS = {"standard", "gregorian", "proleptic_gregorian"} _NS_PER_TIME_DELTA = { + "ns": 1, "us": int(1e3), "ms": int(1e6), "s": int(1e9), @@ -35,7 ...
diff --git a/xarray/tests/test_coding_times.py b/xarray/tests/test_coding_times.py --- a/xarray/tests/test_coding_times.py +++ b/xarray/tests/test_coding_times.py @@ -6,7 +6,7 @@ import pytest from pandas.errors import OutOfBoundsDatetime -from xarray import DataArray, Dataset, Variable, coding, decode_cf +from xar...
Millisecond precision is lost on datetime64 during IO roundtrip <!-- A short summary of the issue, if appropriate --> I have millisecond-resolution time data as a coordinate on a DataArray. That data loses precision when round-tripping through disk. #### MCVE Code Sample <!-- In order for the maintainers to efficientl...
This has something to do with the time values at some point being a float: ```python >>> import numpy as np >>> np.datetime64("2017-02-22T16:24:10.586000000").astype("float64").astype(np.dtype('<M8[ns]')) numpy.datetime64('2017-02-22T16:24:10.585999872') ``` It looks like this is happening somewhere in the [cftime](h...
2020-12-12T21:43:57Z
0.12
["xarray/tests/test_coding_times.py::test_cf_timedelta[1ns-nanoseconds-numbers5]", "xarray/tests/test_coding_times.py::test_encode_cf_datetime_defaults_to_correct_dtype[D-nanoseconds]", "xarray/tests/test_coding_times.py::test_encode_cf_datetime_defaults_to_correct_dtype[H-nanoseconds]", "xarray/tests/test_coding_times...
["xarray/tests/test_coding_times.py::test_cf_timedelta[1D-days-numbers0]", "xarray/tests/test_coding_times.py::test_cf_timedelta[1h-hours-numbers2]", "xarray/tests/test_coding_times.py::test_cf_timedelta[1ms-milliseconds-numbers3]", "xarray/tests/test_coding_times.py::test_cf_timedelta[1us-microseconds-numbers4]", "xar...
1c198a191127c601d091213c4b3292a8bb3054e1
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-repo...
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 ke...
2020-12-13T20:42:40Z
0.12
["xarray/tests/test_computation.py::test_where_attrs"]
["xarray/tests/test_computation.py::test_apply_exclude", "xarray/tests/test_computation.py::test_autocov[None-da_a0]", "xarray/tests/test_computation.py::test_autocov[None-da_a1]", "xarray/tests/test_computation.py::test_autocov[None-da_a2]", "xarray/tests/test_computation.py::test_autocov[None-da_a3]", "xarray/tests/t...
1c198a191127c601d091213c4b3292a8bb3054e1