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
astropy/astropy
astropy__astropy-12057
b6769c18c0881b6d290e543e9334c25043018b3f
diff --git a/astropy/nddata/nduncertainty.py b/astropy/nddata/nduncertainty.py --- a/astropy/nddata/nduncertainty.py +++ b/astropy/nddata/nduncertainty.py @@ -395,6 +395,40 @@ def _propagate_multiply(self, other_uncert, result_data, correlation): def _propagate_divide(self, other_uncert, result_data, correlation):...
diff --git a/astropy/nddata/tests/test_nduncertainty.py b/astropy/nddata/tests/test_nduncertainty.py --- a/astropy/nddata/tests/test_nduncertainty.py +++ b/astropy/nddata/tests/test_nduncertainty.py @@ -4,7 +4,7 @@ import pytest import numpy as np -from numpy.testing import assert_array_equal +from numpy.testing im...
Add helpers to convert between different types of uncertainties Currently there no easy way to convert from an arbitrary uncertainty class to a different uncertainty class. This would be useful to be able to pass NDData objects to external libraries/tools which assume, for example, that uncertainties will always stored...
See also #10128 which is maybe not exactly the same need but related in the sense that there is currently no easy way to get uncertainties in a specific format (variance, std). Very much from the left field, but in coordinate representations, we deal with this by insisting every representation can be transformed to/fro...
2021-08-14T10:06:53Z
4.3
["astropy/nddata/tests/test_nduncertainty.py::test_conversion_to_from_variance_supported[InverseVariance-<lambda>]", "astropy/nddata/tests/test_nduncertainty.py::test_conversion_to_from_variance_supported[StdDevUncertainty-<lambda>]", "astropy/nddata/tests/test_nduncertainty.py::test_conversion_to_from_variance_support...
["astropy/nddata/tests/test_nduncertainty.py::test_assigning_uncertainty_to_parent_gives_correct_unit[InverseVariance-expected_unit2-CCDData]", "astropy/nddata/tests/test_nduncertainty.py::test_assigning_uncertainty_to_parent_gives_correct_unit[InverseVariance-expected_unit2-NDDataArray]", "astropy/nddata/tests/test_nd...
298ccb478e6bf092953bca67a3d29dc6c35f6752
astropy/astropy
astropy__astropy-12842
3a0cd2d8cd7b459cdc1e1b97a14f3040ccc1fffc
diff --git a/astropy/time/core.py b/astropy/time/core.py --- a/astropy/time/core.py +++ b/astropy/time/core.py @@ -34,7 +34,7 @@ from astropy.extern import _strptime -__all__ = ['TimeBase', 'Time', 'TimeDelta', 'TimeInfo', 'update_leap_seconds', +__all__ = ['TimeBase', 'Time', 'TimeDelta', 'TimeInfo', 'TimeInfoBas...
diff --git a/astropy/io/ascii/tests/test_ecsv.py b/astropy/io/ascii/tests/test_ecsv.py --- a/astropy/io/ascii/tests/test_ecsv.py +++ b/astropy/io/ascii/tests/test_ecsv.py @@ -822,13 +822,13 @@ def _make_expected_values(cols): 'name': '2-d regular array', 'subtype': 'float16[2,2]'}] -cols['scalar object'] ...
No longer able to read BinnedTimeSeries with datetime column saved as ECSV after upgrading from 4.2.1 -> 5.0+ <!-- This comments are hidden when you submit the issue, so you do not need to remove them! --> <!-- Please be sure to check out our contributing guidelines, https://github.com/astropy/astropy/blob/main/CONTRI...
I hope you don't mind me tagging you @taldcroft as it was your commit, maybe you can help me figure out if this is a bug or an evolution in `astropy.TimeSeries` that requires an alternative file format? I was pretty happy using ecsv formatted files to save complex data as they have been pretty stable, easy to visually ...
2022-02-12T12:38:10Z
4.3
["astropy/time/tests/test_basic.py::test_write_every_format_to_ecsv[byear]", "astropy/time/tests/test_basic.py::test_write_every_format_to_ecsv[datetime64]", "astropy/time/tests/test_basic.py::test_write_every_format_to_ecsv[datetime]"]
["astropy/io/ascii/tests/test_ecsv.py::astropy.io.ascii.tests.test_ecsv.test_round_trip_masked_table_default", "astropy/io/ascii/tests/test_ecsv.py::test_bad_delimiter", "astropy/io/ascii/tests/test_ecsv.py::test_bad_delimiter_input", "astropy/io/ascii/tests/test_ecsv.py::test_bad_header_start", "astropy/io/ascii/tests...
298ccb478e6bf092953bca67a3d29dc6c35f6752
astropy/astropy
astropy__astropy-12880
b49ad06b4de9577648a55d499d914e08baeef2c6
diff --git a/astropy/io/ascii/ecsv.py b/astropy/io/ascii/ecsv.py --- a/astropy/io/ascii/ecsv.py +++ b/astropy/io/ascii/ecsv.py @@ -129,7 +129,9 @@ def get_cols(self, lines): match = re.match(ecsv_header_re, lines[0].strip(), re.VERBOSE) if not match: raise core.InconsistentTableError(no_h...
diff --git a/astropy/io/ascii/tests/test_ecsv.py b/astropy/io/ascii/tests/test_ecsv.py --- a/astropy/io/ascii/tests/test_ecsv.py +++ b/astropy/io/ascii/tests/test_ecsv.py @@ -21,6 +21,7 @@ from astropy.units import QuantityInfo from astropy.utils.exceptions import AstropyUserWarning +from astropy.utils.compat impor...
No longer able to read BinnedTimeSeries with datetime column saved as ECSV after upgrading from 4.2.1 -> 5.0+ <!-- This comments are hidden when you submit the issue, so you do not need to remove them! --> <!-- Please be sure to check out our contributing guidelines, https://github.com/astropy/astropy/blob/main/CONTRI...
I hope you don't mind me tagging you @taldcroft as it was your commit, maybe you can help me figure out if this is a bug or an evolution in `astropy.TimeSeries` that requires an alternative file format? I was pretty happy using ecsv formatted files to save complex data as they have been pretty stable, easy to visually ...
2022-02-21T13:57:37Z
4.3
["astropy/io/ascii/tests/test_ecsv.py::test_read_bad_datatype_v09", "astropy/io/ascii/tests/test_ecsv.py::test_read_complex_v09"]
["astropy/io/ascii/tests/test_ecsv.py::astropy.io.ascii.tests.test_ecsv.test_round_trip_masked_table_default", "astropy/io/ascii/tests/test_ecsv.py::test_bad_delimiter", "astropy/io/ascii/tests/test_ecsv.py::test_bad_delimiter_input", "astropy/io/ascii/tests/test_ecsv.py::test_bad_header_start", "astropy/io/ascii/tests...
298ccb478e6bf092953bca67a3d29dc6c35f6752
astropy/astropy
astropy__astropy-12907
d16bfe05a744909de4b27f5875fe0d4ed41ce607
diff --git a/astropy/modeling/separable.py b/astropy/modeling/separable.py --- a/astropy/modeling/separable.py +++ b/astropy/modeling/separable.py @@ -242,7 +242,7 @@ def _cstack(left, right): cright = _coord_matrix(right, 'right', noutp) else: cright = np.zeros((noutp, right.shape[1])) - ...
diff --git a/astropy/modeling/tests/test_separable.py b/astropy/modeling/tests/test_separable.py --- a/astropy/modeling/tests/test_separable.py +++ b/astropy/modeling/tests/test_separable.py @@ -28,6 +28,13 @@ p1 = models.Polynomial1D(1, name='p1') +cm_4d_expected = (np.array([False, False, True, True]), + ...
Modeling's `separability_matrix` does not compute separability correctly for nested CompoundModels Consider the following model: ```python from astropy.modeling import models as m from astropy.modeling.separable import separability_matrix cm = m.Linear1D(10) & m.Linear1D(5) ``` It's separability matrix as you might ...
null
2022-03-03T15:14:54Z
4.3
["astropy/modeling/tests/test_separable.py::test_separable[compound_model6-result6]", "astropy/modeling/tests/test_separable.py::test_separable[compound_model9-result9]"]
["astropy/modeling/tests/test_separable.py::test_arith_oper", "astropy/modeling/tests/test_separable.py::test_cdot", "astropy/modeling/tests/test_separable.py::test_coord_matrix", "astropy/modeling/tests/test_separable.py::test_cstack", "astropy/modeling/tests/test_separable.py::test_custom_model_separable", "astropy/m...
298ccb478e6bf092953bca67a3d29dc6c35f6752
astropy/astropy
astropy__astropy-13032
d707b792d3ca45518a53b4a395c81ee86bd7b451
diff --git a/astropy/modeling/bounding_box.py b/astropy/modeling/bounding_box.py --- a/astropy/modeling/bounding_box.py +++ b/astropy/modeling/bounding_box.py @@ -694,6 +694,12 @@ def _validate_dict(self, bounding_box: dict): for key, value in bounding_box.items(): self[key] = value + @proper...
diff --git a/astropy/modeling/tests/test_bounding_box.py b/astropy/modeling/tests/test_bounding_box.py --- a/astropy/modeling/tests/test_bounding_box.py +++ b/astropy/modeling/tests/test_bounding_box.py @@ -12,7 +12,7 @@ _ignored_interval, _Interval, _SelectorArgument, ...
Incorrect ignored usage in `ModelBoundingBox` <!-- This comments are hidden when you submit the issue, so you do not need to remove them! --> <!-- Please be sure to check out our contributing guidelines, https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md . Please be sure to check out our code of conduct, htt...
You just can't differentiate between a robot and the very best of humans. *(A special day message.)*
2022-03-31T16:32:46Z
4.3
["astropy/modeling/tests/test_bounding_box.py::TestCompoundBoundingBox::test___repr__", "astropy/modeling/tests/test_bounding_box.py::TestModelBoundingBox::test_bounding_box_ignore"]
["astropy/modeling/tests/test_bounding_box.py::TestCompoundBoundingBox::test___contains__", "astropy/modeling/tests/test_bounding_box.py::TestCompoundBoundingBox::test___eq__", "astropy/modeling/tests/test_bounding_box.py::TestCompoundBoundingBox::test___getitem__", "astropy/modeling/tests/test_bounding_box.py::TestCom...
298ccb478e6bf092953bca67a3d29dc6c35f6752
astropy/astropy
astropy__astropy-13068
2288ecd4e9c4d3722d72b7f4a6555a34f4f04fc7
diff --git a/astropy/time/core.py b/astropy/time/core.py --- a/astropy/time/core.py +++ b/astropy/time/core.py @@ -655,9 +655,6 @@ def precision(self): @precision.setter def precision(self, val): del self.cache - if not isinstance(val, int) or val < 0 or val > 9: - raise ValueError(...
diff --git a/astropy/time/tests/test_basic.py b/astropy/time/tests/test_basic.py --- a/astropy/time/tests/test_basic.py +++ b/astropy/time/tests/test_basic.py @@ -259,6 +259,20 @@ def test_precision(self): assert t.iso == '2010-01-01 00:00:00.000000000' assert t.tai.utc.iso == '2010-01-01 00:00:00.000...
Time from astropy.time not precise Hello, I encounter difficulties with Time. I'm working on a package to perform photometry and occultation. For this last case, data need times values accurately estimated. Of course, data coming from different camera will will have different time format in the header. to manage th...
Welcome to Astropy 👋 and thank you for your first issue! A project member will respond to you as soon as possible; in the meantime, please double-check the [guidelines for submitting issues](https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md#reporting-issues) and make sure you've provided the requested deta...
2022-04-05T19:35:35Z
5
["astropy/time/tests/test_basic.py::TestBasic::test_precision_input"]
["astropy/time/tests/test_basic.py::TestBasic::test_all_scale_transforms", "astropy/time/tests/test_basic.py::TestBasic::test_copy_time[2455197.5]", "astropy/time/tests/test_basic.py::TestBasic::test_copy_time[value1]", "astropy/time/tests/test_basic.py::TestBasic::test_creating_all_formats", "astropy/time/tests/test_b...
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
astropy/astropy
astropy__astropy-13158
b185ca184f8dd574531dcc21e797f00537fefa6a
diff --git a/astropy/modeling/bounding_box.py b/astropy/modeling/bounding_box.py --- a/astropy/modeling/bounding_box.py +++ b/astropy/modeling/bounding_box.py @@ -520,7 +520,7 @@ def _set_outputs_unit(outputs, valid_outputs_unit): """ if valid_outputs_unit is not None: - return Quantity(o...
diff --git a/astropy/modeling/tests/test_models_quantities.py b/astropy/modeling/tests/test_models_quantities.py --- a/astropy/modeling/tests/test_models_quantities.py +++ b/astropy/modeling/tests/test_models_quantities.py @@ -18,7 +18,7 @@ from astropy.modeling.physical_models import Drude1D, Plummer1D from astropy....
Model evaluation fails if any model parameter is a `MagUnit` type value <!-- This comments are hidden when you submit the issue, so you do not need to remove them! --> <!-- Please be sure to check out our contributing guidelines, https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md . Please be sure to check ou...
Note that the simple change of https://github.com/astropy/astropy/blob/675dc03e138d5c6a1cb6936a6b2c3211f39049d3/astropy/modeling/core.py#L2704 to `value = value * unit` with the above example still passes all the modeling unit tests. However, it produces a different error ```python -------------------------------------...
2022-04-22T17:32:23Z
5
["astropy/modeling/tests/test_models_quantities.py::test_Schechter1D_errors", "astropy/modeling/tests/test_models_quantities.py::test_models_evaluate_magunits[model0]", "astropy/modeling/tests/test_models_quantities.py::test_models_evaluate_magunits[model10]", "astropy/modeling/tests/test_models_quantities.py::test_mod...
["astropy/modeling/tests/test_models_quantities.py::test_compound_model_input_units_equivalencies_defaults[model0]", "astropy/modeling/tests/test_models_quantities.py::test_compound_model_input_units_equivalencies_defaults[model10]", "astropy/modeling/tests/test_models_quantities.py::test_compound_model_input_units_equ...
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
astropy/astropy
astropy__astropy-13236
6ed769d58d89380ebaa1ef52b300691eefda8928
diff --git a/astropy/table/table.py b/astropy/table/table.py --- a/astropy/table/table.py +++ b/astropy/table/table.py @@ -1239,13 +1239,6 @@ def _convert_data_to_col(self, data, copy=True, default_name=None, dtype=None, n f'{fully_qualified_name} ' 'did...
diff --git a/astropy/table/tests/test_mixin.py b/astropy/table/tests/test_mixin.py --- a/astropy/table/tests/test_mixin.py +++ b/astropy/table/tests/test_mixin.py @@ -697,11 +697,13 @@ def test_skycoord_representation(): '1.0,90.0,0.0'] -def test_ndarray_mixin(): +@pytest.mark.parametriz...
Consider removing auto-transform of structured column into NdarrayMixin <!-- This comments are hidden when you submit the issue, so you do not need to remove them! --> <!-- Please be sure to check out our contributing guidelines, https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md . Please be sure to check ou...
@mhvk - I'm happy to do this PR if you think it is a good idea. I agree there no longer is any reason to put structured arrays into `NdarrayMixin` -- indeed, I thought I had already changed its use! So, yes, happy to go ahead and create structured columns directly. So you think we should change it now, or do a release ...
2022-05-09T14:16:30Z
5
["astropy/table/tests/test_mixin.py::test_ndarray_mixin[False]", "astropy/table/tests/test_table.py::test_structured_masked_column"]
["astropy/table/tests/test_mixin.py::test_add_column[arrayswap]", "astropy/table/tests/test_mixin.py::test_add_column[arraywrap]", "astropy/table/tests/test_mixin.py::test_add_column[cartesianrep]", "astropy/table/tests/test_mixin.py::test_add_column[earthlocation]", "astropy/table/tests/test_mixin.py::test_add_column[...
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
astropy/astropy
astropy__astropy-13390
1e75f298aef2540240c63b4075d06851d55fc19a
diff --git a/astropy/table/column.py b/astropy/table/column.py --- a/astropy/table/column.py +++ b/astropy/table/column.py @@ -297,31 +297,23 @@ def _make_compare(oper): oper : str Operator name """ - swapped_oper = {'__eq__': '__eq__', - '__ne__': '__ne__', - ...
diff --git a/astropy/table/tests/test_column.py b/astropy/table/tests/test_column.py --- a/astropy/table/tests/test_column.py +++ b/astropy/table/tests/test_column.py @@ -2,6 +2,7 @@ from astropy.utils.tests.test_metadata import MetaBaseTest import operator +import warnings import pytest import numpy as np @@ -...
BUG: Table test failures with np 1.23.0rc3 ``` ====================================================================== FAILURES ======================================================================= __________________________________________________________ test_col_unicode_sandwich_unicode ____________________________...
Related details: https://github.com/astropy/astroquery/issues/2440#issuecomment-1155588504 xref https://github.com/numpy/numpy/pull/21041 It was merged 4 days ago, so does this mean it went into the RC before it hits the "nightly wheel" that we tests against here? ahh, good point, I forgot that the "nightly" is not in ...
2022-06-23T20:06:08Z
5
["astropy/table/tests/test_column.py::TestColumn::test_quantity_comparison[MaskedColumn]", "astropy/table/tests/test_column.py::test_unicode_sandwich_compare[Column-Column]"]
["astropy/table/tests/test_column.py::TestAttrEqual::test_10[Column]", "astropy/table/tests/test_column.py::TestAttrEqual::test_10[MaskedColumn]", "astropy/table/tests/test_column.py::TestAttrEqual::test_11[Column]", "astropy/table/tests/test_column.py::TestAttrEqual::test_11[MaskedColumn]", "astropy/table/tests/test_c...
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
astropy/astropy
astropy__astropy-13438
4bd88be61fdf4185b9c198f7e689a40041e392ee
diff --git a/astropy/table/jsviewer.py b/astropy/table/jsviewer.py --- a/astropy/table/jsviewer.py +++ b/astropy/table/jsviewer.py @@ -15,7 +15,7 @@ class Conf(_config.ConfigNamespace): """ jquery_url = _config.ConfigItem( - 'https://code.jquery.com/jquery-3.1.1.min.js', + 'https://code.jquery...
diff --git a/astropy/table/tests/test_jsviewer.py b/astropy/table/tests/test_jsviewer.py --- a/astropy/table/tests/test_jsviewer.py +++ b/astropy/table/tests/test_jsviewer.py @@ -13,6 +13,8 @@ from astropy.utils.misc import _NOT_OVERWRITING_MSG_MATCH EXTERN_DIR = abspath(join(dirname(extern.__file__), 'jquery', 'da...
[Security] Jquery 3.1.1 is vulnerable to untrusted code execution <!-- This comments are hidden when you submit the issue, so you do not need to remove them! --> <!-- Please be sure to check out our contributing guidelines, https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md . Please be sure to check out our ...
Welcome to Astropy 👋 and thank you for your first issue! A project member will respond to you as soon as possible; in the meantime, please double-check the [guidelines for submitting issues](https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md#reporting-issues) and make sure you've provided the requested deta...
2022-07-07T07:29:35Z
5
["astropy/table/tests/test_jsviewer.py::test_write_jsviewer_default", "astropy/table/tests/test_jsviewer.py::test_write_jsviewer_local", "astropy/table/tests/test_jsviewer.py::test_write_jsviewer_mixin[mixin0]", "astropy/table/tests/test_jsviewer.py::test_write_jsviewer_mixin[mixin1]", "astropy/table/tests/test_jsviewe...
["astropy/table/tests/test_jsviewer.py::test_write_jsviewer_overwrite"]
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
astropy/astropy
astropy__astropy-13465
0f3e4a6549bc8bb3276184a021ecdd3482eb5d13
diff --git a/astropy/io/fits/diff.py b/astropy/io/fits/diff.py --- a/astropy/io/fits/diff.py +++ b/astropy/io/fits/diff.py @@ -1051,7 +1051,8 @@ def _report(self): index = [x + 1 for x in reversed(index)] self._writeln(f' Data differs at {index}:') report_diff_values(values[0], va...
diff --git a/astropy/io/fits/tests/test_diff.py b/astropy/io/fits/tests/test_diff.py --- a/astropy/io/fits/tests/test_diff.py +++ b/astropy/io/fits/tests/test_diff.py @@ -893,3 +893,35 @@ def test_fitsdiff_with_names(tmpdir): diff = FITSDiff(path1, path2) assert "Extension HDU 1:" in diff.report() + + +def ...
rtol for FITSDiff not working as expected. I have question about the rtol parameter for FITSDiff, when I create a report it appears that the numbers cited as being different are within the given relative tolerance. I couldn't figure out why so I thought this may be a bug, apologies if I'm missing something super obvi...
Welcome to Astropy 👋 and thank you for your first issue! A project member will respond to you as soon as possible; in the meantime, please double-check the [guidelines for submitting issues](https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md#reporting-issues) and make sure you've provided the requested deta...
2022-07-19T08:36:06Z
5
["astropy/io/fits/tests/test_diff.py::test_rawdatadiff_diff_with_rtol"]
["astropy/io/fits/tests/test_diff.py::test_fitsdiff_hdu_name", "astropy/io/fits/tests/test_diff.py::test_fitsdiff_no_hdu_name", "astropy/io/fits/tests/test_diff.py::test_fitsdiff_with_names"]
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
astropy/astropy
astropy__astropy-13469
2b8631e7d64bfc16c70f5c51cda97964d8dd1ae0
diff --git a/astropy/table/table.py b/astropy/table/table.py --- a/astropy/table/table.py +++ b/astropy/table/table.py @@ -1070,7 +1070,12 @@ def __array__(self, dtype=None): supported and will raise a ValueError. """ if dtype is not None: - raise ValueError('Datatype coercion is n...
diff --git a/astropy/table/tests/test_table.py b/astropy/table/tests/test_table.py --- a/astropy/table/tests/test_table.py +++ b/astropy/table/tests/test_table.py @@ -28,6 +28,7 @@ from .conftest import MaskedTable, MIXIN_COLS from astropy.utils.compat.optional_deps import HAS_PANDAS # noqa +from astropy.utils.com...
Can't convert a list of Astropy tables to a NumPy array of tables I recently stumbled upon [a StackOverflow question](https://stackoverflow.com/questions/69414829/convert-a-list-of-astropy-table-in-a-numpy-array-of-astropy-table) where someone likes to convert a list of Tables to a NumPy array. By default, NumPy will c...
FYI, here is a fix that seems to work. If anyone else wants to put this (or some variation) into a PR and add a test etc then feel free! ```diff (astropy) ➜ astropy git:(main) ✗ git diff diff --git a/astropy/table/table.py b/astropy/table/table.py index d3bcaebeb5..6db399a7b8 100644 --- a/astropy/table/table.py +++ b/...
2022-07-21T01:48:13Z
5
["astropy/table/tests/test_table.py::TestConvertNumpyArray::test_convert_list_numpy_object_array[masked]", "astropy/table/tests/test_table.py::TestConvertNumpyArray::test_convert_list_numpy_object_array[subclass]", "astropy/table/tests/test_table.py::TestConvertNumpyArray::test_convert_list_numpy_object_array[unmasked]...
["astropy/table/tests/test_table.py::TestAddColumns::test_add_columns1[masked]", "astropy/table/tests/test_table.py::TestAddColumns::test_add_columns1[subclass]", "astropy/table/tests/test_table.py::TestAddColumns::test_add_columns1[unmasked]", "astropy/table/tests/test_table.py::TestAddColumns::test_add_columns2[maske...
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
astropy/astropy
astropy__astropy-13579
0df94ff7097961e92fd7812036a24b145bc13ca8
diff --git a/astropy/wcs/wcsapi/wrappers/sliced_wcs.py b/astropy/wcs/wcsapi/wrappers/sliced_wcs.py --- a/astropy/wcs/wcsapi/wrappers/sliced_wcs.py +++ b/astropy/wcs/wcsapi/wrappers/sliced_wcs.py @@ -243,6 +243,8 @@ def pixel_to_world_values(self, *pixel_arrays): return world_arrays def world_to_pixel_va...
diff --git a/astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py b/astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py --- a/astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py +++ b/astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py @@ -899,3 +899,39 @@ def test_pixel_to_world_values_different_int_types(): f...
Inconsistent behavior of `world_to_pixel` in `SlicedLowLevelWCS` <!-- This comments are hidden when you submit the issue, so you do not need to remove them! --> <!-- Please be sure to check out our contributing guidelines, https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md . Please be sure to check out our ...
A slightly shorter script to reproduce the issue is this (starting from the definition of `fits_wcs` in the OP): ```python sl = SlicedLowLevelWCS(fits_wcs, 0) world = fits_wcs.pixel_to_world_values(0,0,0) out_pix = sl.world_to_pixel_values(world[0], world[1]) assert np.allclose(out_pix[0], 0) ``` The root of the iss...
2022-08-26T15:06:53Z
5
["astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py::test_coupled_world_slicing"]
["astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py::test_1d_sliced_low_level", "astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py::test_celestial_range", "astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py::test_celestial_range_rot", "astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py::test_celestial_slice",...
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
astropy/astropy
astropy__astropy-13745
0446f168dc6e34996482394f00770b52756b8f9c
diff --git a/astropy/coordinates/angles.py b/astropy/coordinates/angles.py --- a/astropy/coordinates/angles.py +++ b/astropy/coordinates/angles.py @@ -587,7 +587,7 @@ def _validate_angles(self, angles=None): if angles.unit is u.deg: limit = 90 elif angles.unit is u.rad: - limit...
diff --git a/astropy/coordinates/tests/test_angles.py b/astropy/coordinates/tests/test_angles.py --- a/astropy/coordinates/tests/test_angles.py +++ b/astropy/coordinates/tests/test_angles.py @@ -1092,3 +1092,54 @@ def test_str_repr_angles_nan(cls, input, expstr, exprepr): # Deleting whitespaces since repr appears ...
float32 representation of pi/2 is rejected by `Latitude` <!-- This comments are hidden when you submit the issue, so you do not need to remove them! --> <!-- Please be sure to check out our contributing guidelines, https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md . Please be sure to check out our code of c...
> Be lenient? E.g. only make the comparison up to float 32 precision? Instead, we could make the comparison based on the precision of the ``dtype``, using something like https://numpy.org/doc/stable/reference/generated/numpy.finfo.html?highlight=finfo#numpy.finfo That's a funny one! I think @nstarman's suggestion woul...
2022-09-23T11:54:47Z
5
["astropy/coordinates/tests/test_angles.py::test_latitude_limits[value2-expected_value2-None-float32--1]", "astropy/coordinates/tests/test_angles.py::test_latitude_limits[value2-expected_value2-None-float32-1]", "astropy/coordinates/tests/test_angles.py::test_latitude_limits[value3-expected_value3-float32-float32--1]",...
["astropy/coordinates/tests/test_angles.py::test__str__", "astropy/coordinates/tests/test_angles.py::test_angle_convert", "astropy/coordinates/tests/test_angles.py::test_angle_format_roundtripping", "astropy/coordinates/tests/test_angles.py::test_angle_formatting", "astropy/coordinates/tests/test_angles.py::test_angle_...
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
astropy/astropy
astropy__astropy-13838
a6c712375ed38d422812e013566a34f928677acd
diff --git a/astropy/table/pprint.py b/astropy/table/pprint.py --- a/astropy/table/pprint.py +++ b/astropy/table/pprint.py @@ -392,7 +392,8 @@ def _pformat_col_iter(self, col, max_lines, show_name, show_unit, outs, if multidims: multidim0 = tuple(0 for n in multidims) multidim1 = tupl...
diff --git a/astropy/table/tests/test_pprint.py b/astropy/table/tests/test_pprint.py --- a/astropy/table/tests/test_pprint.py +++ b/astropy/table/tests/test_pprint.py @@ -972,3 +972,18 @@ def test_embedded_newline_tab(): r' a b \n c \t \n d', r' x y\n'] assert t.pformat_all() == ex...
Printing tables doesn't work correctly with 0-length array cells <!-- This comments are hidden when you submit the issue, so you do not need to remove them! --> <!-- Please be sure to check out our contributing guidelines, https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md . Please be sure to check out our c...
The root cause of this is that astropy delegates to numpy to convert a list of values into a numpy array. Notice the differences in output `dtype` here: ``` In [25]: np.array([[], []]) Out[25]: array([], shape=(2, 0), dtype=float64) In [26]: np.array([[], [], [1, 2]]) Out[26]: array([list([]), list([]), list([1, 2])],...
2022-10-15T11:03:12Z
5
["astropy/table/tests/test_pprint.py::test_multidims_with_zero_dim"]
["astropy/table/tests/test_pprint.py::TestColumnsShowHide::test_add_remove[value1-pprint_exclude_names]", "astropy/table/tests/test_pprint.py::TestColumnsShowHide::test_add_remove[value1-pprint_include_names]", "astropy/table/tests/test_pprint.py::TestColumnsShowHide::test_add_remove[value2-pprint_exclude_names]", "ast...
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
astropy/astropy
astropy__astropy-14096
1a4462d72eb03f30dc83a879b1dd57aac8b2c18b
diff --git a/astropy/coordinates/sky_coordinate.py b/astropy/coordinates/sky_coordinate.py --- a/astropy/coordinates/sky_coordinate.py +++ b/astropy/coordinates/sky_coordinate.py @@ -894,10 +894,8 @@ def __getattr__(self, attr): if frame_cls is not None and self.frame.is_transformable_to(frame_cls): ...
diff --git a/astropy/coordinates/tests/test_sky_coord.py b/astropy/coordinates/tests/test_sky_coord.py --- a/astropy/coordinates/tests/test_sky_coord.py +++ b/astropy/coordinates/tests/test_sky_coord.py @@ -2165,3 +2165,21 @@ def test_match_to_catalog_3d_and_sky(): npt.assert_array_equal(idx, [0, 1, 2, 3]) as...
Subclassed SkyCoord gives misleading attribute access message I'm trying to subclass `SkyCoord`, and add some custom properties. This all seems to be working fine, but when I have a custom property (`prop` below) that tries to access a non-existent attribute (`random_attr`) below, the error message is misleading becaus...
This is because the property raises an `AttributeError`, which causes Python to call `__getattr__`. You can catch the `AttributeError` in the property and raise another exception with a better message. The problem is it's a nightmare for debugging at the moment. If I had a bunch of different attributes in `prop(self)`,...
2022-12-04T17:06:07Z
5.1
["astropy/coordinates/tests/test_sky_coord.py::test_subclass_property_exception_error"]
["astropy/coordinates/tests/test_sky_coord.py::test_apply_space_motion", "astropy/coordinates/tests/test_sky_coord.py::test_attr_conflicts", "astropy/coordinates/tests/test_sky_coord.py::test_attr_inheritance", "astropy/coordinates/tests/test_sky_coord.py::test_cache_clear_sc", "astropy/coordinates/tests/test_sky_coord...
5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5
astropy/astropy
astropy__astropy-14484
09e54670e4a46ed510e32d8206e4853920684952
diff --git a/astropy/units/quantity_helper/function_helpers.py b/astropy/units/quantity_helper/function_helpers.py --- a/astropy/units/quantity_helper/function_helpers.py +++ b/astropy/units/quantity_helper/function_helpers.py @@ -75,9 +75,10 @@ np.put, np.fill_diagonal, np.tile, np.repeat, np.split, np.array...
diff --git a/astropy/units/tests/test_quantity_non_ufuncs.py b/astropy/units/tests/test_quantity_non_ufuncs.py --- a/astropy/units/tests/test_quantity_non_ufuncs.py +++ b/astropy/units/tests/test_quantity_non_ufuncs.py @@ -17,7 +17,7 @@ TBD_FUNCTIONS, UNSUPPORTED_FUNCTIONS, ) -from astropy.utils.compat impor...
New Quantity warning starting with yesterday's numpy-dev ### Description Starting today, `photutils` CI tests with `astropy-dev` and `numpy-dev` started failing due a new warning. I've extracted a MWE showing the warning: ```python import astropy.units as u import pytest from numpy.testing import assert_equal a = [...
We saw this downstream in Jdaviz too. cc @bmorris3
2023-03-02T18:48:46Z
5.1
["astropy/units/tests/test_quantity_non_ufuncs.py::TestFunctionHelpersCompleteness::test_all_included", "astropy/units/tests/test_quantity_non_ufuncs.py::TestUfuncReductions::test_max", "astropy/units/tests/test_quantity_non_ufuncs.py::TestUfuncReductions::test_min"]
["astropy/units/tests/test_quantity_non_ufuncs.py::TestAccessingParts::test_compress", "astropy/units/tests/test_quantity_non_ufuncs.py::TestAccessingParts::test_delete", "astropy/units/tests/test_quantity_non_ufuncs.py::TestAccessingParts::test_diag", "astropy/units/tests/test_quantity_non_ufuncs.py::TestAccessingPart...
5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5
astropy/astropy
astropy__astropy-14578
c748299218dcbd9e15caef558722cc04aa658fad
diff --git a/astropy/io/fits/column.py b/astropy/io/fits/column.py --- a/astropy/io/fits/column.py +++ b/astropy/io/fits/column.py @@ -1528,7 +1528,19 @@ def _init_from_array(self, array): for idx in range(len(array.dtype)): cname = array.dtype.names[idx] ftype = array.dtype.fields[cn...
diff --git a/astropy/io/fits/tests/test_connect.py b/astropy/io/fits/tests/test_connect.py --- a/astropy/io/fits/tests/test_connect.py +++ b/astropy/io/fits/tests/test_connect.py @@ -414,6 +414,61 @@ def test_mask_str_on_read(self, tmp_path): tab = Table.read(filename, mask_invalid=False) assert tab.m...
Writing a Table to FITS fails if the table contains objects The following works fine: ``` Python from astropy.table import Table Table([{'col1': None}]).write('/tmp/tmp.txt', format='ascii') ``` whereas the following fails: ``` Python Table([{'col1': None}]).write('/tmp/tmp.fits', format='fits') ``` with ``` /home...
Hm. I wonder if there's a place in the I/O registry for readers/writers to provide some means of listing what data formats they can accept--or at least rejecting formats that they don't accept. Maybe something to think about as part of #962 ? I should add--I think the current behavior is "correct"--any convention for...
2023-03-24T20:31:26Z
5.1
["astropy/io/fits/tests/test_connect.py::TestSingleTable::test_heterogeneous_VLA_tables", "astropy/io/fits/tests/test_connect.py::TestSingleTable::test_write_VLA_tables_with_unified", "astropy/io/fits/tests/test_connect.py::TestSingleTable::test_write_object_tables_with_unified"]
["astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read", "astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_from_hdulist", "astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_from_hdulist_in_last_hdu[0]", "astropy/io/fits/tests/test_connect.py::TestMultipleHDU::test_read_from...
5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5
astropy/astropy
astropy__astropy-14590
5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5
diff --git a/astropy/utils/masked/core.py b/astropy/utils/masked/core.py --- a/astropy/utils/masked/core.py +++ b/astropy/utils/masked/core.py @@ -671,20 +671,35 @@ def __ne__(self, other): ) return result.any(axis=-1) - def _combine_masks(self, masks, out=None): + def _combine_masks(self, mas...
diff --git a/astropy/utils/masked/tests/test_functions.py b/astropy/utils/masked/tests/test_functions.py --- a/astropy/utils/masked/tests/test_functions.py +++ b/astropy/utils/masked/tests/test_functions.py @@ -11,6 +11,7 @@ from astropy import units as u from astropy.units import Quantity +from astropy.utils.compa...
TST: np.fix check fails with numpy-dev (TypeError: cannot write to unmasked output) Started popping up in numpy-dev jobs. @mhvk is investigating. ``` ____________________________ TestUfuncLike.test_fix ____________________________ self = <astropy.utils.masked.tests.test_function_helpers.TestUfuncLike object at 0x7fdd...
Ah, yes, that was https://github.com/numpy/numpy/pull/23240 and we actually checked in that discussion whether it would pose problems for astropy - https://github.com/numpy/numpy/pull/23240#discussion_r1112314891 - conclusion was that only `np.fix` was affected and that it would be a trivial fix. I'll make that now...
2023-03-27T23:57:35Z
5.1
["astropy/utils/masked/tests/test_functions.py::TestMaskedArrayUfuncs::test_ufunc_inplace_masked_where[False]", "astropy/utils/masked/tests/test_functions.py::TestMaskedArrayUfuncs::test_ufunc_inplace_masked_where[True]", "astropy/utils/masked/tests/test_functions.py::TestMaskedArrayUfuncs::test_ufunc_inplace_where[Fal...
["astropy/utils/masked/tests/test_functions.py::TestMaskedArrayBroadcast::test_broadcast_arrays", "astropy/utils/masked/tests/test_functions.py::TestMaskedArrayBroadcast::test_broadcast_arrays_not_all_masked", "astropy/utils/masked/tests/test_functions.py::TestMaskedArrayBroadcast::test_broadcast_arrays_subok_false", "...
5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5
astropy/astropy
astropy__astropy-14628
c667e73df92215cf1446c3eda71a56fdaebba426
diff --git a/astropy/coordinates/earth.py b/astropy/coordinates/earth.py --- a/astropy/coordinates/earth.py +++ b/astropy/coordinates/earth.py @@ -655,21 +655,26 @@ def to_geocentric(self): """Convert to a tuple with X, Y, and Z as quantities.""" return (self.x, self.y, self.z) - def get_itrs(sel...
diff --git a/astropy/coordinates/tests/test_intermediate_transformations.py b/astropy/coordinates/tests/test_intermediate_transformations.py --- a/astropy/coordinates/tests/test_intermediate_transformations.py +++ b/astropy/coordinates/tests/test_intermediate_transformations.py @@ -1036,24 +1036,12 @@ def test_itrs_str...
Make getting a topocentric ITRS position easier ### What is the problem this feature will solve? Right now, it is not easy to create ITRS coordinates for sources relative to a given location (rather than geocentric), to the level that we have specific instructions on how to calculate relative `CartesianCoordinates` an...
Hi, I am interested in signing up for this issue. This would be my first contribution here @ninja18 - great! Easiest is to go ahead and make a PR. I assume you are familiar with the astronomy side of it? (see "Additional Context" above)
2023-04-12T10:00:55Z
5.2
["astropy/coordinates/tests/test_intermediate_transformations.py::test_itrs_straight_overhead"]
["astropy/coordinates/tests/test_intermediate_transformations.py::TestGetLocationGCRS::test_cirs_quick", "astropy/coordinates/tests/test_intermediate_transformations.py::TestGetLocationGCRS::test_get_gcrs_posvel", "astropy/coordinates/tests/test_intermediate_transformations.py::TestGetLocationGCRS::test_tete_quick", "a...
362f6df12abf9bd769d4915fabf955c993ea22cf
astropy/astropy
astropy__astropy-14907
7f0df518e6bd5542b64bd7073052d099ea09dcb4
diff --git a/astropy/table/index.py b/astropy/table/index.py --- a/astropy/table/index.py +++ b/astropy/table/index.py @@ -94,7 +94,7 @@ def __init__(self, columns, engine=None, unique=False): raise ValueError("Cannot create index without at least one column") elif len(columns) == 1: ...
diff --git a/astropy/table/tests/test_groups.py b/astropy/table/tests/test_groups.py --- a/astropy/table/tests/test_groups.py +++ b/astropy/table/tests/test_groups.py @@ -690,3 +690,23 @@ def test_group_mixins_unsupported(col): tg = t.group_by("a") with pytest.warns(AstropyUserWarning, match="Cannot aggregate...
TST: test_table_group_by[True] and test_group_by_masked[True] failed with numpy 1.25rc1 I see this in the predeps job that pulls in numpy 1.25rc1. Example log: https://github.com/astropy/astropy/actions/runs/5117103756/jobs/9199883166 Hard to discern between the other 100+ failures from https://github.com/astropy/astr...
I cannot reproduce this locally. 🤯 The error log above looks like some lines moved about... but it does not make sense. Also, to run this in an interactive session: ```python import numpy as np from astropy import units as u from astropy.table import QTable T = QTable.read( [ " a b c d", ...
2023-06-03T10:29:17Z
5.2
["astropy/table/tests/test_groups.py::test_group_by_masked[True]", "astropy/table/tests/test_groups.py::test_group_stable_sort[True]", "astropy/table/tests/test_groups.py::test_table_group_by[True]"]
["astropy/table/tests/test_groups.py::test_column_aggregate[False]", "astropy/table/tests/test_groups.py::test_column_aggregate[True]", "astropy/table/tests/test_groups.py::test_column_aggregate_f8", "astropy/table/tests/test_groups.py::test_column_filter", "astropy/table/tests/test_groups.py::test_column_group_by[Fals...
362f6df12abf9bd769d4915fabf955c993ea22cf
astropy/astropy
astropy__astropy-14995
b16c7d12ccbc7b2d20364b89fb44285bcbfede54
diff --git a/astropy/nddata/mixins/ndarithmetic.py b/astropy/nddata/mixins/ndarithmetic.py --- a/astropy/nddata/mixins/ndarithmetic.py +++ b/astropy/nddata/mixins/ndarithmetic.py @@ -520,10 +520,10 @@ def _arithmetic_mask(self, operation, operand, handle_mask, axis=None, **kwds): elif self.mask is None and ope...
diff --git a/astropy/nddata/mixins/tests/test_ndarithmetic.py b/astropy/nddata/mixins/tests/test_ndarithmetic.py --- a/astropy/nddata/mixins/tests/test_ndarithmetic.py +++ b/astropy/nddata/mixins/tests/test_ndarithmetic.py @@ -1310,3 +1310,42 @@ def test_raise_method_not_supported(): # raise error for unsupported ...
In v5.3, NDDataRef mask propagation fails when one of the operand does not have a mask ### Description This applies to v5.3. It looks like when one of the operand does not have a mask, the mask propagation when doing arithmetic, in particular with `handle_mask=np.bitwise_or` fails. This is not a problem in v5.2. I...
Welcome to Astropy 👋 and thank you for your first issue! A project member will respond to you as soon as possible; in the meantime, please double-check the [guidelines for submitting issues](https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md#reporting-issues) and make sure you've provided the requested deta...
2023-06-27T19:48:18Z
5.2
["astropy/nddata/mixins/tests/test_ndarithmetic.py::test_nddata_bitmask_arithmetic"]
["astropy/nddata/mixins/tests/test_ndarithmetic.py::test_arithmetics_data[data10-data20]", "astropy/nddata/mixins/tests/test_ndarithmetic.py::test_arithmetics_data[data11-data21]", "astropy/nddata/mixins/tests/test_ndarithmetic.py::test_arithmetics_data[data12-data22]", "astropy/nddata/mixins/tests/test_ndarithmetic.py...
362f6df12abf9bd769d4915fabf955c993ea22cf
astropy/astropy
astropy__astropy-7008
264d967708a3dcdb2bce0ed9f9ca3391c40f3ff3
diff --git a/astropy/constants/__init__.py b/astropy/constants/__init__.py --- a/astropy/constants/__init__.py +++ b/astropy/constants/__init__.py @@ -13,8 +13,8 @@ <Quantity 0.510998927603161 MeV> """ - -import itertools +import inspect +from contextlib import contextmanager # Hack to make circular imports ...
diff --git a/astropy/constants/tests/test_prior_version.py b/astropy/constants/tests/test_prior_version.py --- a/astropy/constants/tests/test_prior_version.py +++ b/astropy/constants/tests/test_prior_version.py @@ -1,7 +1,5 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst - - import copy import...
Context manager for constant versions For some use cases it would be helpful to have a context manager to set the version set of the constants. E.g., something like ``` with constants_set(astropyconst13): ... code goes here ... ````
I am trying to take a stab at this but no promises.
2017-12-19T20:24:08Z
1.3
["astropy/constants/tests/test_prior_version.py::test_context_manager"]
["astropy/constants/tests/test_prior_version.py::test_b_wien", "astropy/constants/tests/test_prior_version.py::test_c", "astropy/constants/tests/test_prior_version.py::test_copy", "astropy/constants/tests/test_prior_version.py::test_e", "astropy/constants/tests/test_prior_version.py::test_g0", "astropy/constants/tests/...
848c8fa21332abd66b44efe3cb48b72377fb32cc
astropy/astropy
astropy__astropy-7166
26d147868f8a891a6009a25cd6a8576d2e1bd747
diff --git a/astropy/utils/misc.py b/astropy/utils/misc.py --- a/astropy/utils/misc.py +++ b/astropy/utils/misc.py @@ -4,9 +4,6 @@ A "grab bag" of relatively small general-purpose utilities that don't have a clear module/package to live in. """ - - - import abc import contextlib import difflib @@ -27,7 +24,6 @@ ...
diff --git a/astropy/utils/tests/test_misc.py b/astropy/utils/tests/test_misc.py --- a/astropy/utils/tests/test_misc.py +++ b/astropy/utils/tests/test_misc.py @@ -80,14 +80,26 @@ def __call__(self, *args): "FOO" pass + @property + def bar(self): + "BAR" + ...
InheritDocstrings metaclass doesn't work for properties Inside the InheritDocstrings metaclass it uses `inspect.isfunction` which returns `False` for properties.
This was as implemented back in #2159. I don't see any `inspect.isproperty`. Do you have any suggestions? I guess it should work with [inspect.isdatadescriptor](https://docs.python.org/3/library/inspect.html#inspect.isdatadescriptor). And I wonder if this class is still needed, it seems that it started with #2136 for ...
2018-02-07T15:05:31Z
1.3
["astropy/utils/tests/test_misc.py::test_inherit_docstrings"]
["astropy/utils/tests/test_misc.py::test_JsonCustomEncoder", "astropy/utils/tests/test_misc.py::test_check_broadcast", "astropy/utils/tests/test_misc.py::test_dtype_bytes_or_chars", "astropy/utils/tests/test_misc.py::test_isiterable", "astropy/utils/tests/test_misc.py::test_signal_number_to_name_no_failure", "astropy/u...
848c8fa21332abd66b44efe3cb48b72377fb32cc
astropy/astropy
astropy__astropy-7218
9626265d77b8a21c113615c08bc6782deb52eaed
diff --git a/astropy/io/fits/hdu/hdulist.py b/astropy/io/fits/hdu/hdulist.py --- a/astropy/io/fits/hdu/hdulist.py +++ b/astropy/io/fits/hdu/hdulist.py @@ -510,6 +510,25 @@ def fileinfo(self, index): return output + def __copy__(self): + """ + Return a shallow copy of an HDUList. + + ...
diff --git a/astropy/io/fits/tests/test_hdulist.py b/astropy/io/fits/tests/test_hdulist.py --- a/astropy/io/fits/tests/test_hdulist.py +++ b/astropy/io/fits/tests/test_hdulist.py @@ -5,6 +5,7 @@ import os import platform import sys +import copy import pytest import numpy as np @@ -376,6 +377,43 @@ def test_file_...
HDUList.copy() returns a list Currently ``HDUList.copy()`` returns a list rather than an ``HDUList``: ```python In [1]: from astropy.io.fits import HDUList In [2]: hdulist = HDUList() In [3]: hdulist.copy() Out[3]: [] In [4]: type(_) Out[4]: list ``` This is with Python 3.6.
This might be related to another issue reported in #7185 where adding two `HDUList`s also produces a `list` instead of another `HDUList`. We should be able to fix this specific case by overriding `list.copy()` method with: ```python class HDUList(list, _Verify): ... def copy(self): return self[:] .....
2018-02-20T11:36:56Z
1.3
["astropy/io/fits/tests/test_hdulist.py::TestHDUListFunctions::test_shallow_copy"]
["astropy/io/fits/tests/test_hdulist.py::TestHDUListFunctions::test_append_extension_to_empty_list", "astropy/io/fits/tests/test_hdulist.py::TestHDUListFunctions::test_append_groupshdu_to_empty_list", "astropy/io/fits/tests/test_hdulist.py::TestHDUListFunctions::test_append_groupshdu_to_non_empty_list", "astropy/io/fit...
848c8fa21332abd66b44efe3cb48b72377fb32cc
astropy/astropy
astropy__astropy-7606
3cedd79e6c121910220f8e6df77c54a0b344ea94
diff --git a/astropy/units/core.py b/astropy/units/core.py --- a/astropy/units/core.py +++ b/astropy/units/core.py @@ -728,7 +728,7 @@ def __eq__(self, other): try: other = Unit(other, parse_strict='silent') except (ValueError, UnitsError, TypeError): - return False + ...
diff --git a/astropy/units/tests/test_units.py b/astropy/units/tests/test_units.py --- a/astropy/units/tests/test_units.py +++ b/astropy/units/tests/test_units.py @@ -185,6 +185,13 @@ def test_unknown_unit3(): assert unit != unit3 assert not unit.is_equivalent(unit3) + # Also test basic (in)equalities. +...
Unit equality comparison with None raises TypeError for UnrecognizedUnit ``` In [12]: x = u.Unit('asdf', parse_strict='silent') In [13]: x == None # Should be False --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <...
`x is None` works fine. Is there a reason why `==` is needed here? `x is None` would indeed be preferred, but `==` should never fail, so this is still a bug.
2018-06-29T16:27:46Z
1.3
["astropy/units/tests/test_units.py::test_unknown_unit3"]
["astropy/units/tests/test_units.py::test_all_units", "astropy/units/tests/test_units.py::test_barn_prefixes", "astropy/units/tests/test_units.py::test_cds_power", "astropy/units/tests/test_units.py::test_compare_with_none", "astropy/units/tests/test_units.py::test_comparison", "astropy/units/tests/test_units.py::test_...
848c8fa21332abd66b44efe3cb48b72377fb32cc
astropy/astropy
astropy__astropy-7671
a7141cd90019b62688d507ae056298507678c058
diff --git a/astropy/utils/introspection.py b/astropy/utils/introspection.py --- a/astropy/utils/introspection.py +++ b/astropy/utils/introspection.py @@ -4,6 +4,7 @@ import inspect +import re import types import importlib from distutils.version import LooseVersion @@ -139,6 +140,14 @@ def minversion(module, ve...
diff --git a/astropy/utils/tests/test_introspection.py b/astropy/utils/tests/test_introspection.py --- a/astropy/utils/tests/test_introspection.py +++ b/astropy/utils/tests/test_introspection.py @@ -67,7 +67,7 @@ def test_minversion(): from types import ModuleType test_module = ModuleType(str("test_module")) ...
minversion failures The change in PR #7647 causes `minversion` to fail in certain cases, e.g.: ``` >>> from astropy.utils import minversion >>> minversion('numpy', '1.14dev') TypeError Traceback (most recent call last) <ipython-input-1-760e6b1c375e> in <module>() 1 from astropy.uti...
Oops, sounds like we should put the regex back in that was there for `LooseVersion` - definitely don't want to go back to `pkg_resources`... Huh I don't understand why I couldn't reproduce this before. Well I guess we know why that regexp was there before! @mhvk - will you open a PR to restore the regexp?
2018-07-20T19:37:49Z
1.3
["astropy/utils/tests/test_introspection.py::test_minversion"]
["astropy/utils/tests/test_introspection.py::test_find_current_mod", "astropy/utils/tests/test_introspection.py::test_find_mod_objs", "astropy/utils/tests/test_introspection.py::test_pkg_finder"]
848c8fa21332abd66b44efe3cb48b72377fb32cc
astropy/astropy
astropy__astropy-8251
2002221360f4ad75f6b275bbffe4fa68412299b3
diff --git a/astropy/units/format/generic.py b/astropy/units/format/generic.py --- a/astropy/units/format/generic.py +++ b/astropy/units/format/generic.py @@ -274,7 +274,9 @@ def p_factor_int(p): def p_factor_fits(p): ''' factor_fits : UINT power OPEN_PAREN signed_int CLOSE_PAREN + ...
diff --git a/astropy/units/tests/test_format.py b/astropy/units/tests/test_format.py --- a/astropy/units/tests/test_format.py +++ b/astropy/units/tests/test_format.py @@ -434,40 +434,42 @@ def test_vounit_implicit_custom(): assert x.bases[0]._represents.bases[0].name == 'urlong' -def test_fits_scale_factor(): ...
FITS-standard unit parsing fails on some types of exponents Why don't these work: ```python from astropy.units import Unit Unit('10**17 erg/(cm2 s Angstrom)', format='fits') Unit('10^17 erg/(cm2 s Angstrom)', format='fits') ``` When these all do: ```python from astropy.units import Unit Unit('10+17 erg/(cm2 s Angstrom)...
Additional examples that *do* work: ```python Unit('10**+17 erg/(cm2 s Angstrom)', format='fits') Unit('10^+17 erg/(cm2 s Angstrom)', format='fits') ``` It seems that currently the sign is always required for the `**` and `^`, though it should not: > The final units string is the compound string, or a compound of comp...
2018-12-07T20:21:59Z
3
["astropy/units/tests/test_format.py::test_fits_scale_factor[10**(2)-100-10**2]", "astropy/units/tests/test_format.py::test_fits_scale_factor[10**2-100-10**2]", "astropy/units/tests/test_format.py::test_fits_scale_factor[10^(2)-100-10**2]", "astropy/units/tests/test_format.py::test_fits_scale_factor[10^2-100-10**2]"]
["astropy/units/tests/test_format.py::test_cds_grammar[strings0-unit0]", "astropy/units/tests/test_format.py::test_cds_grammar[strings1-unit1]", "astropy/units/tests/test_format.py::test_cds_grammar[strings10-unit10]", "astropy/units/tests/test_format.py::test_cds_grammar[strings11-unit11]", "astropy/units/tests/test_f...
de88208326dc4cd68be1c3030f4f6d2eddf04520
django/django
django__django-10087
02cd16a7a04529c726e5bb5a13d5979119f25c7d
diff --git a/django/core/management/commands/sqlmigrate.py b/django/core/management/commands/sqlmigrate.py --- a/django/core/management/commands/sqlmigrate.py +++ b/django/core/management/commands/sqlmigrate.py @@ -1,3 +1,4 @@ +from django.apps import apps from django.core.management.base import BaseCommand, CommandEr...
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 @@ -1434,6 +1434,14 @@ def test_migrate_app_name_specified_as_label(self): with self.assertRaisesMessage(CommandError, self.did_you_mean_auth_error)...
Misleading sqlmigrate "App 'apps.somethings' does not have migrations." error message Description This ticket is very similar to https://code.djangoproject.com/ticket/29506 As shown above, validation should be added sqlmigrate.
​https://github.com/django/django/pull/10087 I added validation to sqlmigrate
2018-06-23T05:35:26Z
2.2
["--squashed-name specifies the new migration's name."]
["--squashed-name also works if a start migration is omitted.", "Migration directories without an __init__.py file are allowed.", "test_failing_migration (migrations.test_commands.MakeMigrationsTests)", "test_files_content (migrations.test_commands.MakeMigrationsTests)", "test_makemigration_merge_dry_run (migrations.te...
4fc35a9c3efdc9154efce28cb23cb84f8834517e
django/django
django__django-10554
14d026cccb144c6877294ba4cd4e03ebf0842498
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -356,7 +356,12 @@ def get_order_by(self): resolved.set_source_expressions([RawSQL('%d' % (idx + 1), ())]) br...
diff --git a/tests/queries/test_qs_combinators.py b/tests/queries/test_qs_combinators.py --- a/tests/queries/test_qs_combinators.py +++ b/tests/queries/test_qs_combinators.py @@ -153,6 +153,29 @@ def test_union_with_values_list_on_annotated_and_unannotated(self): qs2 = Number.objects.filter(num=9) sel...
Union queryset with ordering breaks on ordering with derived querysets Description (last modified by Sergei Maertens) May be related to #29692 Simple reproduction (the exact models are not relevant I think): >>> Dimension.objects.values_list('id', flat=True) <QuerySet [10, 11, 12, 13, 14, 15, 16, 17, 18]> >>> q...
Looks like a bug caused by a .query attribute change without performing a prior copy() of the query/queryset. Attaching a regression test that fails on master (tested at f3d3338e06d571a529bb2046428eeac8e56bcbf6). ​PR Tests aren't passing. Needs more tests, at the least. But discussion on PR suggests we've not hit the r...
2018-10-24T14:24:45Z
3
["test_union_with_values_list_and_order (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_union_with_values_list_on_annotated_and_unannotated (queries.test_qs_combinators.QuerySetSetOperationTests)"]
["test_combining_multiple_models (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_count_difference (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_count_intersection (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_count_union (queries.test_qs_combinators.QuerySetSetOperati...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-10606
0315c18fe170b1b611b7d10b5dde2f196b89a7e0
diff --git a/django/db/models/fields/reverse_related.py b/django/db/models/fields/reverse_related.py --- a/django/db/models/fields/reverse_related.py +++ b/django/db/models/fields/reverse_related.py @@ -114,7 +114,10 @@ def __repr__(self): self.related_model._meta.model_name, ) - def get_choi...
diff --git a/tests/admin_filters/tests.py b/tests/admin_filters/tests.py --- a/tests/admin_filters/tests.py +++ b/tests/admin_filters/tests.py @@ -741,6 +741,43 @@ def test_relatedonlyfieldlistfilter_foreignkey(self): expected = [(self.alfred.pk, 'alfred'), (self.bob.pk, 'bob')] self.assertEqual(sorte...
Using RelatedOnlyFieldListFilter with reverse ManyToMany crashes Description (last modified by Tim Graham) Using RelatedOnlyFieldListFilter with a reverse ManyToMany relation causes this exception: get_choices() got an unexpected keyword argument 'limit_choices_to' This method in ForeignObjectRel.get_choices is...
I can't reproduce the crash on a ManyToManyField with limit_choices_to. Could you give more details? Apologies for my lack of response on this, have been traveling. I'm going to be working on adding tests for my fix ASAP but here's a minimal example of how to trigger: Demo of how to trigger bug: ​https://github.com/mgr...
2018-11-04T02:46:48Z
3.1
["test_get_choices_reverse_related_field (model_fields.tests.GetChoicesLimitChoicesToTests)", "test_relatedonlyfieldlistfilter_foreignkey_reverse_relationships (admin_filters.tests.ListFiltersTests)", "test_relatedonlyfieldlistfilter_manytomany_reverse_relationships (admin_filters.tests.ListFiltersTests)"]
["A translated display value is coerced to str.", "Can supply a custom choices form class to Field.formfield()", "Field instances can be pickled.", "Field.formfield() sets disabled for fields with choices.", "Fields are ordered based on their creation.", "Filtering by an invalid value.", "RelatedFieldListFilter orderin...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-10643
28e769dfe6a65bf604f5adc6a650ab47ba6b3bef
diff --git a/django/db/models/lookups.py b/django/db/models/lookups.py --- a/django/db/models/lookups.py +++ b/django/db/models/lookups.py @@ -5,7 +5,7 @@ from django.core.exceptions import EmptyResultSet from django.db.models.expressions import Case, Exists, Func, Value, When from django.db.models.fields import ( -...
diff --git a/tests/model_fields/test_uuid.py b/tests/model_fields/test_uuid.py --- a/tests/model_fields/test_uuid.py +++ b/tests/model_fields/test_uuid.py @@ -2,7 +2,9 @@ import uuid from django.core import exceptions, serializers -from django.db import IntegrityError, models +from django.db import IntegrityError, ...
Allow icontains lookup to accept uuids with or without dashes Description We have Django 2.1 project with model admin which includes an UUIDField in list_display and search_fields. The UUID is displayed with dashes on changelist (e.g. "245ba2eb-6852-47be-82be-7dc07327cf9e") and if the user cut'n'paste it to the searc...
This isn't really an admin issue but rather it's due to the fact that the default admin lookup uses __icontains. You could fix the issue by using search_fields = ['uuidfield__exact'] (adding __exact) although that doesn't allow searching for part of the UUID value. I'll tentatively accept the ticket to allow QuerySet.o...
2018-11-12T19:24:06Z
3.1
["test_contains (model_fields.test_uuid.TestQuerying)", "test_endswith (model_fields.test_uuid.TestQuerying)", "test_filter_with_expr (model_fields.test_uuid.TestQuerying)", "test_icontains (model_fields.test_uuid.TestQuerying)", "test_iendswith (model_fields.test_uuid.TestQuerying)", "test_iexact (model_fields.test_uu...
["test_creation (model_fields.test_uuid.TestAsPrimaryKey)", "test_deconstruct (model_fields.test_uuid.TestMethods)", "test_dumping (model_fields.test_uuid.TestSerialization)", "test_exact (model_fields.test_uuid.TestQuerying)", "test_invalid_uuid (model_fields.test_uuid.TestValidation)", "test_isnull (model_fields.test...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-10939
1933e56eca1ad17de7dd133bfb7cbee9858a75a3
diff --git a/django/forms/widgets.py b/django/forms/widgets.py --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -48,8 +48,8 @@ def __init__(self, media=None, css=None, js=None): css = {} if js is None: js = [] - self._css = css - self._js = js +...
diff --git a/tests/forms_tests/tests/test_media.py b/tests/forms_tests/tests/test_media.py --- a/tests/forms_tests/tests/test_media.py +++ b/tests/forms_tests/tests/test_media.py @@ -541,3 +541,33 @@ def test_merge_warning(self): msg = 'Detected duplicate Media files in an opposite order:\n1\n2' with ...
ModelAdmin with custom widgets, inlines, and filter_horizontal can merge media in broken order Description when a modeadmin have a inline with a filed has its own media js no need jquery , and have a one to many field show filter_horizontal, the problem appear. there will be MediaOrderConflictWarning and inlines.js l...
This is the test program I dove into this for a while. I'm not sure if there's anything that Django can do about it. Reverting 03974d81220ffd237754a82c77913799dd5909a4 solves the problem but that'll break other cases. The root causes seems to be that ckeditor/ckeditor/ckeditor.js is collected before jquery in one case ...
2019-02-05T14:02:21Z
3
["test_merge_css_three_way (forms_tests.tests.test_media.FormsMediaTestCase)", "test_merge_js_three_way (forms_tests.tests.test_media.FormsMediaTestCase)"]
["test_combine_media (forms_tests.tests.test_media.FormsMediaTestCase)", "test_construction (forms_tests.tests.test_media.FormsMediaTestCase)", "test_form_media (forms_tests.tests.test_media.FormsMediaTestCase)", "test_html_safe (forms_tests.tests.test_media.FormsMediaTestCase)", "test_media_dsl (forms_tests.tests.test...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-10957
48c17807a99f7a4341c74db19e16a37b010827c2
diff --git a/django/utils/translation/__init__.py b/django/utils/translation/__init__.py --- a/django/utils/translation/__init__.py +++ b/django/utils/translation/__init__.py @@ -2,9 +2,11 @@ Internationalization support. """ import re +import warnings from contextlib import ContextDecorator from django.utils.au...
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -23,6 +23,7 @@ RequestFactory, SimpleTestCase, TestCase, override_settings, ) from django.utils import translation +from django.utils.deprecation import RemovedInDjango40Warning from django.utils.format...
Deprecate ugettext(), ugettext_lazy(), ugettext_noop(), ungettext(), and ungettext_lazy() Description Along the lines of #27753 (Cleanups when no supported version of Django supports Python 2 anymore), the legacy functions in django.utils.translation -- ugettext(), ugettext_lazy(), ugettext_noop(), ungettext(), and u...
null
2019-02-08T02:22:31Z
3
["test_legacy_aliases (i18n.tests.TranslationTests)"]
["Empty value must stay empty after being translated (#23196).", "OSError is raised if the default language is unparseable.", "test_admin_javascript_supported_input_formats (i18n.tests.FormattingTests)", "test_all_format_strings (i18n.tests.FormattingTests)", "test_app_translation (i18n.tests.AppResolutionOrderI18NTest...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-10973
ddb293685235fd09e932805771ae97f72e817181
diff --git a/django/db/backends/postgresql/client.py b/django/db/backends/postgresql/client.py --- a/django/db/backends/postgresql/client.py +++ b/django/db/backends/postgresql/client.py @@ -2,17 +2,9 @@ import signal import subprocess -from django.core.files.temp import NamedTemporaryFile from django.db.backends....
diff --git a/tests/dbshell/test_postgresql.py b/tests/dbshell/test_postgresql.py --- a/tests/dbshell/test_postgresql.py +++ b/tests/dbshell/test_postgresql.py @@ -1,5 +1,6 @@ import os import signal +import subprocess from unittest import mock from django.db.backends.postgresql.client import DatabaseClient @@ -11...
Use subprocess.run and PGPASSWORD for client in postgres backend Description ​subprocess.run was added in python 3.5 (which is the minimum version since Django 2.1). This function allows you to pass a custom environment for the subprocess. Using this in django.db.backends.postgres.client to set PGPASSWORD simplifies ...
null
2019-02-11T01:19:56Z
3
["SIGINT is ignored in Python and passed to psql to abort quries.", "test_accent (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_basic (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_column (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_nopass (dbshell.test_post...
[]
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-10999
36300ef336e3f130a0dadc1143163ff3d23dc843
diff --git a/django/utils/dateparse.py b/django/utils/dateparse.py --- a/django/utils/dateparse.py +++ b/django/utils/dateparse.py @@ -29,9 +29,10 @@ standard_duration_re = re.compile( r'^' r'(?:(?P<days>-?\d+) (days?, )?)?' - r'((?:(?P<hours>-?\d+):)(?=\d+:\d+))?' - r'(?:(?P<minutes>-?\d+):)?' - r'...
diff --git a/tests/utils_tests/test_dateparse.py b/tests/utils_tests/test_dateparse.py --- a/tests/utils_tests/test_dateparse.py +++ b/tests/utils_tests/test_dateparse.py @@ -113,9 +113,12 @@ def test_negative(self): test_values = ( ('-4 15:30', timedelta(days=-4, minutes=15, seconds=30)), ...
Fix parse_duration() for some negative durations Description The ​https://docs.djangoproject.com/en/2.1/_modules/django/utils/dateparse/ defines: standard_duration_re = re.compile( r'^' r'(?:(?P<days>-?\d+) (days?, )?)?' r'((?:(?P<hours>-?\d+):)(?=\d+:\d+))?' r'(?:(?P<minutes>-?\d+):)?' r'(?P<seconds>-?\d+)' r'...
Please give an example valid that's not working. There are ​some tests for negative values. Right, this should have been fixed by #27699 which is included in 1.11.x. Example cases, can be discussed: parse_duration('-00:01:01') => plus 61 seconds, so it is not -(00:01:01) but (-00):(+01):(+01) parse_duration('00:-01:-01...
2019-02-16T07:44:50Z
3
["test_negative (utils_tests.test_dateparse.DurationParseTests)", "test_parse_postgresql_format (utils_tests.test_dateparse.DurationParseTests)"]
["test_days (utils_tests.test_dateparse.DurationParseTests)", "test_fractions_of_seconds (utils_tests.test_dateparse.DurationParseTests)", "test_hours_minutes_seconds (utils_tests.test_dateparse.DurationParseTests)", "test_iso_8601 (utils_tests.test_dateparse.DurationParseTests)", "test_minutes_seconds (utils_tests.tes...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11085
f976ab1b117574db78d884c94e549a6b8e4c9f9b
diff --git a/django/db/models/base.py b/django/db/models/base.py --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -84,9 +84,12 @@ def __new__(cls, name, bases, attrs, **kwargs): # Pass all attrs without a (Django-specific) contribute_to_class() # method to type.__new__() so that they'r...
diff --git a/tests/model_regress/tests.py b/tests/model_regress/tests.py --- a/tests/model_regress/tests.py +++ b/tests/model_regress/tests.py @@ -2,9 +2,10 @@ from operator import attrgetter from django.core.exceptions import ValidationError -from django.db import router +from django.db import models, router from...
Custom model metaclasses cannot access the attribute dict in __init__ Description In Django <=2.2, it is possible for models to define a custom metaclass (as a subclass of models.base.ModelBase) and access the attribute dict of the class being defined: from django.db import models class PageBase(models.base.ModelBase...
null
2019-03-14T17:47:04Z
3
["test_metaclass_can_access_attribute_dict (model_regress.tests.ModelTests)"]
["test_chained_fks (model_regress.tests.ModelTests)", "test_date_filter_null (model_regress.tests.ModelTests)", "test_date_lookup (model_regress.tests.ModelTests)", "test_empty_choice (model_regress.tests.ModelTests)", "test_get_next_prev_by_field (model_regress.tests.ModelTests)", "test_get_next_prev_by_field_unsaved ...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11138
c84b91b7603e488f7171fdff8f08368ef3d6b856
diff --git a/django/db/backends/mysql/operations.py b/django/db/backends/mysql/operations.py --- a/django/db/backends/mysql/operations.py +++ b/django/db/backends/mysql/operations.py @@ -69,8 +69,8 @@ def date_trunc_sql(self, lookup_type, field_name): return "DATE(%s)" % (field_name) def _convert_fi...
diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py --- a/tests/timezones/tests.py +++ b/tests/timezones/tests.py @@ -47,6 +47,26 @@ ICT = timezone.get_fixed_timezone(420) # Asia/Bangkok +@contextmanager +def override_database_connection_timezone(timezone): + try: + orig_timezone = conn...
TIME_ZONE value in DATABASES settings is not used when making dates timezone-aware on MySQL, SQLite, and Oracle. Description (last modified by Victor Talpaert) (We assume the mysql backends) I can set TIME_ZONE several times in settings.py, one for the global django app, and one for each database (see ​https://...
Opened a pull request on github with a quick fix, it's tested but lacks a TestCase ​https://github.com/django/django/pull/8714 Looks reasonable at a brief review. ​PR
2019-03-28T13:11:56Z
3
["test_query_convert_timezones (timezones.tests.NewDatabaseTests)"]
["test_auto_now_and_auto_now_add (timezones.tests.LegacyDatabaseTests)", "test_auto_now_and_auto_now_add (timezones.tests.NewDatabaseTests)", "test_aware_datetime_in_local_timezone (timezones.tests.NewDatabaseTests)", "test_aware_datetime_in_local_timezone_with_microsecond (timezones.tests.NewDatabaseTests)", "test_awa...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11141
5d9cf79baf07fc4aed7ad1b06990532a65378155
diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py --- a/django/db/migrations/loader.py +++ b/django/db/migrations/loader.py @@ -84,11 +84,6 @@ def load_disk(self): continue raise else: - # Empty directories are namespaces. - ...
diff --git a/tests/migrations/test_loader.py b/tests/migrations/test_loader.py --- a/tests/migrations/test_loader.py +++ b/tests/migrations/test_loader.py @@ -508,6 +508,17 @@ def test_ignore_files(self): migrations = [name for app, name in loader.disk_migrations if app == 'migrations'] self.assertEqu...
Allow migrations directories without __init__.py files Description (last modified by Tim Graham) Background: In python 3 a package with no __init__.py is implicitly a namespace package, so it has no __file__ attribute. The migrate command currently checks for existence of a __file__ attribute on the migrations...
null
2019-03-28T20:49:53Z
3.1
["Migration directories without an __init__.py file are loaded."]
["Files prefixed with underscore, tilde, or dot aren't loaded.", "Tests loading a complex but erroneous set of squashed migrations", "Tests loading a complex set of squashed migrations", "Tests loading a squashed migration", "Tests loading a squashed migration with a new migration referencing it", "Tests prefix name ma...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-11155
cef3f2d3c64055c9fc1757fd61dba24b557a2add
diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -154,6 +154,9 @@ def gettext_noop(s): LANGUAGE_COOKIE_AGE = None LANGUAGE_COOKIE_DOMAIN = None LANGUAGE_COOKIE_PATH = '/' +LANGUAGE_COOKIE_SECURE = False +LANGUAGE...
diff --git a/tests/view_tests/tests/test_i18n.py b/tests/view_tests/tests/test_i18n.py --- a/tests/view_tests/tests/test_i18n.py +++ b/tests/view_tests/tests/test_i18n.py @@ -45,6 +45,9 @@ def test_setlang(self): self.assertEqual(language_cookie['domain'], '') self.assertEqual(language_cookie['path'],...
Support setting Secure, HttpOnly, SameSite on the language cookie Description I propose to add the following settings, with the following default values: LANGUAGE_COOKIE_SECURE = False LANGUAGE_COOKIE_HTTPONLY = False LANGUAGE_COOKIE_SAMESITE = None The default values maintain the current behavior. These settings do ...
null
2019-04-01T10:04:40Z
3
["test_setlang_cookie (view_tests.tests.test_i18n.SetLanguageTests)"]
["The javascript_catalog can be deployed with language settings", "test_escaping (view_tests.tests.test_i18n.I18NViewTests)", "test_get_formats (view_tests.tests.test_i18n.I18NViewTests)", "test_i18n_different_non_english_languages (view_tests.tests.test_i18n.I18NViewTests)", "test_i18n_english_variant (view_tests.test...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11163
e6588aa4e793b7f56f4cadbfa155b581e0efc59a
diff --git a/django/forms/models.py b/django/forms/models.py --- a/django/forms/models.py +++ b/django/forms/models.py @@ -83,7 +83,7 @@ def model_to_dict(instance, fields=None, exclude=None): for f in chain(opts.concrete_fields, opts.private_fields, opts.many_to_many): if not getattr(f, 'editable', False...
diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py --- a/tests/model_forms/tests.py +++ b/tests/model_forms/tests.py @@ -1814,6 +1814,10 @@ class Meta: bw = BetterWriter.objects.create(name='Joe Better', score=10) self.assertEqual(sorted(model_to_dict(bw)), ['id', 'name', 'score', ...
model_to_dict() should return an empty dict for an empty list of fields. Description Been called as model_to_dict(instance, fields=[]) function should return empty dict, because no fields were requested. But it returns all fields The problem point is if fields and f.name not in fields: which should be if fields is no...
model_to_dict() is a part of private API. Do you have any real use case for passing empty list to this method? ​PR This method is comfortable to fetch instance fields values without touching ForeignKey fields. List of fields to be fetched is an attr of the class, which can be overridden in subclasses and is empty list ...
2019-04-02T21:46:42Z
3
["test_modelform_subclassed_model (model_forms.tests.ModelOneToOneFieldTests)"]
["A custom formfield_callback is used if provided", "Check basic URL field validation on model forms", "Data for a ManyToManyField is a list rather than a lazy QuerySet.", "Ensure keys and blank character strings are tested for uniqueness.", "FilePathField(blank=True) includes the empty option.", "ModelForm test of uni...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11165
af5ec222ccd24e81f9fec6c34836a4e503e7ccf7
diff --git a/django/http/request.py b/django/http/request.py --- a/django/http/request.py +++ b/django/http/request.py @@ -369,6 +369,10 @@ def __init__(self, environ): headers[name] = value super().__init__(headers) + def __getitem__(self, key): + """Allow header lookup using unde...
diff --git a/tests/requests/tests.py b/tests/requests/tests.py --- a/tests/requests/tests.py +++ b/tests/requests/tests.py @@ -896,6 +896,7 @@ def test_wsgi_request_headers_getitem(self): request = WSGIRequest(self.ENVIRON) self.assertEqual(request.headers['User-Agent'], 'python-requests/1.2.0') ...
New HTTPRequest.headers not usable in templates because of hyphens Description With the release of 2.2, I took the opportunity from the new ​HTTPRequest.headers object to clean up old code using e.g. request.META['HTTP_X_REAL_IP'] to request.headers['X-Real-IP']. However, this new approach does not work with template...
Patch added. Hi Mark. The default answer for the template later is to implement a filter that will let you do the lookup with a string. (​StackOverflow has lots of examples.) Maybe we could allow this by adding a key.replace('_', '-') implementing HttpHeaders.__getitem__()? (Probably worth seeing what a patch there loo...
2019-04-03T11:25:53Z
3
["test_wsgi_request_headers_getitem (requests.tests.RequestHeadersTests)"]
["get_host() makes helpful suggestions if a valid-looking host is not in ALLOWED_HOSTS.", "test_FILES_connection_error (requests.tests.RequestsTests)", "test_POST_after_body_read (requests.tests.RequestsTests)", "test_POST_after_body_read_and_stream_read (requests.tests.RequestsTests)", "test_POST_after_body_read_and_s...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11166
85676979a4845fa9b586ec42d4ddbdb9f28b7cc8
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 @@ -65,7 +65,6 @@ def check_dependencies(**kwargs): ('django.contrib.contenttypes', 401), ('django.contrib.auth', 405), ('django.contrib.messa...
diff --git a/tests/admin_checks/tests.py b/tests/admin_checks/tests.py --- a/tests/admin_checks/tests.py +++ b/tests/admin_checks/tests.py @@ -5,6 +5,7 @@ from django.contrib.auth.middleware import AuthenticationMiddleware from django.contrib.contenttypes.admin import GenericStackedInline from django.contrib.message...
Admin app has too hard a dependency on sessions app Description Since #29695 (371ece2f0682e51f2f796854d3e091827a7cea63), released in 2.2, the admin app checks whether the django.contrib.sessions app is in INSTALLED_APPS. Some projects may have opted to use a replacement session management app such as ​https://github....
System checks are ​designed to be silenced if not appropriate. I'm inclined to think this just such an edge-case at first glance. But OK, yes, I guess subclasses are as legitimate here as elsewhere, so accepting as a Cleanup/Optimisation. I'll work on a PR, then. :) ​PR
2019-04-03T12:25:37Z
3
["manage.py check does not raise an ImportError validating a", "test_admin_check_ignores_import_error_in_middleware (admin_checks.tests.SystemChecksTestCase)", "test_apps_dependencies (admin_checks.tests.SystemChecksTestCase)", "test_checks_are_performed (admin_checks.tests.SystemChecksTestCase)", "test_context_process...
["\"", "--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...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11179
19fc6376ce67d01ca37a91ef2f55ef769f50513a
diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py --- a/django/db/models/deletion.py +++ b/django/db/models/deletion.py @@ -277,6 +277,7 @@ def delete(self): if self.can_fast_delete(instance): with transaction.mark_for_rollback_on_error(): count ...
diff --git a/tests/delete/tests.py b/tests/delete/tests.py --- a/tests/delete/tests.py +++ b/tests/delete/tests.py @@ -1,6 +1,7 @@ from math import ceil from django.db import IntegrityError, connection, models +from django.db.models.deletion import Collector from django.db.models.sql.constants import GET_ITERATOR_...
delete() on instances of models without any dependencies doesn't clear PKs. Description Deleting any model with no dependencies not updates the PK on the model. It should be set to None after .delete() call. See Django.db.models.deletion:276-281. Should update the model line 280.
Reproduced at 1ffddfc233e2d5139cc6ec31a4ec6ef70b10f87f. Regression in bc7dd8490b882b2cefdc7faf431dc64c532b79c9. Thanks for the report. Regression test. I have attached a simple fix which mimics what ​https://github.com/django/django/blob/master/django/db/models/deletion.py#L324-L326 does for multiple objects. I am not ...
2019-04-05T15:54:39Z
3
["test_fast_delete_instance_set_pk_none (delete.tests.FastDeleteTests)"]
["test_auto (delete.tests.OnDeleteTests)", "test_auto_nullable (delete.tests.OnDeleteTests)", "test_bulk (delete.tests.DeletionTests)", "test_can_defer_constraint_checks (delete.tests.DeletionTests)", "test_cascade (delete.tests.OnDeleteTests)", "test_cascade_from_child (delete.tests.OnDeleteTests)", "test_cascade_from...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11239
d87bd29c4f8dfcdf3f4a4eb8340e6770a2416fe3
diff --git a/django/db/backends/postgresql/client.py b/django/db/backends/postgresql/client.py --- a/django/db/backends/postgresql/client.py +++ b/django/db/backends/postgresql/client.py @@ -17,6 +17,10 @@ def runshell_db(cls, conn_params): dbname = conn_params.get('database', '') user = conn_params.g...
diff --git a/tests/dbshell/test_postgresql.py b/tests/dbshell/test_postgresql.py --- a/tests/dbshell/test_postgresql.py +++ b/tests/dbshell/test_postgresql.py @@ -14,15 +14,16 @@ def _run_it(self, dbinfo): That function invokes the runshell command, while mocking subprocess.run(). It returns a 2-tuple...
Add support for postgresql client certificates and key to dbshell. Description This bug is very similar to the #28322 A common security procedure for DB access is to require mutual TLS for the DB connection. This involves specifying a server certificate, client certificate, and client key when connecting. Django alre...
null
2019-04-16T09:44:54Z
3
["test_ssl_certificate (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)"]
["SIGINT is ignored in Python and passed to psql to abort quries.", "test_accent (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_basic (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_column (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_nopass (dbshell.test_post...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11244
0c916255eb4d94e06e123fafec93efdba45b1259
diff --git a/django/core/checks/translation.py b/django/core/checks/translation.py --- a/django/core/checks/translation.py +++ b/django/core/checks/translation.py @@ -24,12 +24,6 @@ id='translation.E004', ) -E005 = Error( - 'You have provided values in the LANGUAGES_BIDI setting that are not in ' - 'the L...
diff --git a/tests/check_framework/test_translation.py b/tests/check_framework/test_translation.py --- a/tests/check_framework/test_translation.py +++ b/tests/check_framework/test_translation.py @@ -80,15 +80,7 @@ def test_inconsistent_language_settings(self): 'You have provided a value for the LANGUAGE_CO...
Remove the LANGUAGES_BIDI<=LANGUAGES check. Description (Adding Nick Pope to Cc: as author of the commit referenced below) Since ​https://github.com/django/django/commit/4400d8296d268f5a8523cd02ddc33b12219b2535 there is a system check which verifies that LANGUAGES_BIDI is a subset of LANGUAGES. This breaks almost all...
Thanks for the report, however there is not a valid use case for using LANGUAGES_BIDI that are not in LANGUAGES, that's why we added this check. I don't think that it is a big issue to override LANGUAGES_BIDI (when you override LANGUAGES) or silence this checks. We do not put system checks into release notes normally, ...
2019-04-17T06:51:04Z
3
["test_inconsistent_language_settings (check_framework.test_translation.TranslationCheckTests)"]
["test_invalid_language_code (check_framework.test_translation.TranslationCheckTests)", "test_invalid_languages (check_framework.test_translation.TranslationCheckTests)", "test_invalid_languages_bidi (check_framework.test_translation.TranslationCheckTests)", "test_valid_language_code (check_framework.test_translation.T...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11298
a9179ab032cda80801e7f67ef20db5ee60989f21
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -1234,18 +1234,6 @@ def _check_relationship_model(self, from_model=None, **kwargs): to_model_name = to_model._meta.object_name ...
diff --git a/tests/invalid_models_tests/test_relative_fields.py b/tests/invalid_models_tests/test_relative_fields.py --- a/tests/invalid_models_tests/test_relative_fields.py +++ b/tests/invalid_models_tests/test_relative_fields.py @@ -260,24 +260,6 @@ class Group(models.Model): field = Group._meta.get_field('m...
Allow ManyToManyField using a intermediary table to be defined as symmetrical. Description Thanks to the work made by Collin Anderson in #9475 I think we can remove the check "fields.E332 Many-to-many fields with intermediate tables must not be symmetrical." with a little adjustment. This change was discussed in the...
null
2019-04-28T09:13:45Z
3
["Ref #22047.", "test_accessor_clash (invalid_models_tests.test_relative_fields.SelfReferentialFKClashTests)", "test_accessor_clash (invalid_models_tests.test_relative_fields.SelfReferentialM2MClashTests)", "test_add_on_m2m_with_intermediate_model (m2m_through.tests.M2mThroughTests)", "test_add_on_m2m_with_intermediate...
[]
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11333
55b68de643b5c2d5f0a8ea7587ab3b2966021ccc
diff --git a/django/urls/base.py b/django/urls/base.py --- a/django/urls/base.py +++ b/django/urls/base.py @@ -7,7 +7,7 @@ from django.utils.translation import override from .exceptions import NoReverseMatch, Resolver404 -from .resolvers import get_ns_resolver, get_resolver +from .resolvers import _get_cached_resol...
diff --git a/tests/urlpatterns/test_resolvers.py b/tests/urlpatterns/test_resolvers.py --- a/tests/urlpatterns/test_resolvers.py +++ b/tests/urlpatterns/test_resolvers.py @@ -1,5 +1,6 @@ from django.test import SimpleTestCase -from django.urls.resolvers import RegexPattern, RoutePattern +from django.test.utils import ...
Optimization: Multiple URLResolvers may be unintentionally be constructed by calls to `django.urls.resolvers.get_resolver` Description Multiple URLResolvers may be constructed by django.urls.resolvers.get_resolver if django.urls.base.set_urlconf has not yet been called, resulting in multiple expensive calls to URLRes...
I'm planning to contribute a fix, as soon as I can get the CLA signed. Hi. Great. Happy to provisionally Accept this pending how the patch looks. (Sounds fine in principle.) Welcome on-board! :)
2019-05-06T21:00:53Z
3
["test_resolver_cache_default__root_urlconf (urlpatterns.test_resolvers.ResolverCacheTests)"]
["test_str (urlpatterns.test_resolvers.RegexPatternTests)", "test_str (urlpatterns.test_resolvers.RoutePatternTests)"]
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11396
59f04d6b8f6c7c7a1039185bd2c5653ea91f7ff7
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -5,7 +5,8 @@ from django.core.exceptions import EmptyResultSet, FieldError from django.db.models.constants import LOOKUP_SEP -from django.db.models.expres...
diff --git a/tests/ordering/tests.py b/tests/ordering/tests.py --- a/tests/ordering/tests.py +++ b/tests/ordering/tests.py @@ -1,7 +1,10 @@ from datetime import datetime from operator import attrgetter -from django.db.models import Count, DateTimeField, F, Max, OuterRef, Subquery +from django.core.exceptions import...
Cannot order query by constant value on PostgreSQL Description (last modified by Sven R. Kunze) MyModel.objects.annotate(my_column=Value('asdf')).order_by('my_column').values_list('id') ProgrammingError: non-integer constant in ORDER BY LINE 1: ...odel"."id" FROM "mymodel" ORDER BY 'asdf' ASC... Does it qualify...
I don't see what the use of ordering by a constant string value is. Anyway, it looks like this is a database limitation. I don't see what the use of ordering by a constant string value is. Reducing code complexity (e.g. fewer ifs). The code overview from #26192: # 1 create complex queryset ... more code # 2 annotate an...
2019-05-21T18:25:06Z
3
["test_order_by_constant_value_without_output_field (ordering.tests.OrderingTests)", "test_order_by_f_expression (ordering.tests.OrderingTests)"]
["F expressions can be used in Meta.ordering.", "test_default_ordering (ordering.tests.OrderingTests)", "test_default_ordering_override (ordering.tests.OrderingTests)", "test_deprecated_values_annotate (ordering.tests.OrderingTests)", "test_extra_ordering (ordering.tests.OrderingTests)", "test_extra_ordering_quoting (o...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11399
b711eafd2aabdf22e1d529bfb76dd8d3356d7000
diff --git a/django/utils/functional.py b/django/utils/functional.py --- a/django/utils/functional.py +++ b/django/utils/functional.py @@ -79,7 +79,7 @@ def __init__(self, args, kw): self.__kw = kw if not self.__prepared: self.__prepare_class__() - self.__prepared =...
diff --git a/tests/utils_tests/test_functional.py b/tests/utils_tests/test_functional.py --- a/tests/utils_tests/test_functional.py +++ b/tests/utils_tests/test_functional.py @@ -1,3 +1,5 @@ +from unittest import mock + from django.test import SimpleTestCase from django.utils.functional import cached_property, lazy ...
lazy() class preparation is not being cached correctly. Description Doing self.__prepared = True changes the instance, but the intention is to change the class variable: ​https://github.com/django/django/blob/888fdf182e164fa4b24aa82fa833c90a2b9bee7a/django/utils/functional.py#L82 This makes functions like gettext_laz...
null
2019-05-22T09:09:50Z
3
["test_lazy_class_preparation_caching (utils_tests.test_functional.FunctionalTests)"]
["Disallow this case because the decorated function wouldn't be cached.", "cached_property caches its value and behaves like a property.", "lazy also finds base class methods in the proxy object", "lazy finds the correct (overridden) method implementation", "test_cached_property_auto_name (utils_tests.test_functional.F...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11405
2007e11d7069b0f6ed673c7520ee7f480f07de68
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -281,6 +281,7 @@ def get_order_by(self): if not isinstance(field, OrderBy): field = field.asc() if not ...
diff --git a/tests/ordering/tests.py b/tests/ordering/tests.py --- a/tests/ordering/tests.py +++ b/tests/ordering/tests.py @@ -210,6 +210,15 @@ def test_reversed_ordering(self): def test_reverse_ordering_pure(self): qs1 = Article.objects.order_by(F('headline').asc()) qs2 = qs1.reverse() + ...
Queryset ordering and Meta.ordering are mutable on expressions with reverse(). Description Queryset order and Meta.ordering are mutable with reverse(). Bug revealed by running ./runtests.py ordering.test --reverse (reproduced at a2c31e12da272acc76f3a3a0157fae9a7f6477ac). It seems that test added in f218a2ff455b5f7391...
null
2019-05-23T07:01:53Z
3
["test_reverse_meta_ordering_pure (ordering.tests.OrderingTests)", "test_reverse_ordering_pure (ordering.tests.OrderingTests)"]
["F expressions can be used in Meta.ordering.", "test_default_ordering (ordering.tests.OrderingTests)", "test_default_ordering_override (ordering.tests.OrderingTests)", "test_deprecated_values_annotate (ordering.tests.OrderingTests)", "test_extra_ordering (ordering.tests.OrderingTests)", "test_extra_ordering_quoting (o...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11417
3dca8738cbbbb5674f795169e5ea25e2002f2d71
diff --git a/django/core/mail/message.py b/django/core/mail/message.py --- a/django/core/mail/message.py +++ b/django/core/mail/message.py @@ -2,15 +2,15 @@ from email import ( charset as Charset, encoders as Encoders, generator, message_from_string, ) -from email.errors import InvalidHeaderDefect, NonASCIILocal...
diff --git a/tests/mail/tests.py b/tests/mail/tests.py --- a/tests/mail/tests.py +++ b/tests/mail/tests.py @@ -748,10 +748,30 @@ def test_sanitize_address(self): 'utf-8', '=?utf-8?q?to=40other=2Ecom?= <to@example.com>', ), + ( + ('To Example', 'to...
Update mail backend to use modern standard library parsing approach. Description django.core.mail.message.sanitize_address uses email.utils.parseaddr from the standard lib. On Python 3, email.headerregistry.parser.get_mailbox() does the same, and is less error-prone.
null
2019-05-26T17:32:11Z
3
["Email addresses are properly sanitized.", "test_sanitize_address_invalid (mail.tests.MailTests)", "test_space_continuation (mail.tests.MailTests)"]
["#23063 -- RFC-compliant messages are sent over SMTP.", "A UTF-8 charset with a custom body encoding is respected.", "A message isn't sent if it doesn't have any recipients.", "Make sure opening a connection creates a new file", "Regression test for #14964", "Regression test for #7722", "Regression test for #9367", "T...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11422
df46b329e0900e9e4dc1d60816c1dce6dfc1094e
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -114,7 +114,15 @@ def iter_modules_and_files(modules, extra_files): # During debugging (with PyDev) the 'typing.io' and 'typing.re' objects # are added to sys.modul...
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py --- a/tests/utils_tests/test_autoreload.py +++ b/tests/utils_tests/test_autoreload.py @@ -132,6 +132,10 @@ def test_module_without_spec(self): del module.__spec__ self.assertEqual(autoreload.iter_modules_and_files...
Autoreloader with StatReloader doesn't track changes in manage.py. Description (last modified by Mariusz Felisiak) This is a bit convoluted, but here we go. Environment (OSX 10.11): $ python -V Python 3.6.2 $ pip -V pip 19.1.1 $ pip install Django==2.2.1 Steps to reproduce: Run a server python manage.py runserv...
Thanks for the report. I simplified scenario. Regression in c8720e7696ca41f3262d5369365cc1bd72a216ca. Reproduced at 8d010f39869f107820421631111417298d1c5bb9. Argh. I guess this is because manage.py isn't showing up in the sys.modules. I'm not sure I remember any specific manage.py handling in the old implementation, so...
2019-05-27T19:15:21Z
3
["test_main_module_is_resolved (utils_tests.test_autoreload.TestIterModulesAndFiles)"]
[".pyc and .pyo files are included in the files list.", "iter_all_python_module_file() ignores weakref modules.", "test_calls_start_django (utils_tests.test_autoreload.RunWithReloaderTests)", "test_calls_sys_exit (utils_tests.test_autoreload.RunWithReloaderTests)", "test_check_errors (utils_tests.test_autoreload.TestIt...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11525
29240a99526f5f2a234a9093cd7e001f32ba1801
diff --git a/django/core/mail/__init__.py b/django/core/mail/__init__.py --- a/django/core/mail/__init__.py +++ b/django/core/mail/__init__.py @@ -91,6 +91,8 @@ def mail_admins(subject, message, fail_silently=False, connection=None, """Send a message to the admins, as defined by the ADMINS setting.""" if not ...
diff --git a/tests/mail/tests.py b/tests/mail/tests.py --- a/tests/mail/tests.py +++ b/tests/mail/tests.py @@ -991,6 +991,23 @@ def test_empty_admins(self): mail_managers('hi', 'there') self.assertEqual(self.get_mailbox_content(), []) + def test_wrong_admins_managers(self): + tests = ( + ...
Raise exceptions in mail_admins()/mail_managers() when settings are not in expected formats. Description Hi, First time writing a ticket so I apologize if I do anything improperly here. This issue just arose on a project I've been working on, and it goes as follows: Our MANAGERS setting was set like so: MANAGERS = ['...
Thanks for the report. It seems reasonable to raise ValueError in mail_admins() and mail_managers() when settings are not in expected formats.
2019-06-28T23:52:53Z
3
["test_arbitrary_keyword (mail.tests.MailTests)", "test_auth_attempted (mail.tests.SMTPBackendTests)", "test_close_connection (mail.tests.FileBackendTests)", "test_wrong_admins_managers (mail.tests.ConsoleBackendTests)", "test_wrong_admins_managers (mail.tests.FileBackendTests)", "test_wrong_admins_managers (mail.tests...
["#23063 -- RFC-compliant messages are sent over SMTP.", "A UTF-8 charset with a custom body encoding is respected.", "A message isn't sent if it doesn't have any recipients.", "Email addresses are properly sanitized.", "Make sure opening a connection creates a new file", "Regression test for #14964", "Regression test ...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11583
60dc957a825232fdda9138e2f8878b2ca407a7c9
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -143,6 +143,10 @@ def iter_modules_and_files(modules, extra_files): # The module could have been removed, don't fail loudly if this # is the case. ...
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py --- a/tests/utils_tests/test_autoreload.py +++ b/tests/utils_tests/test_autoreload.py @@ -140,6 +140,17 @@ def test_main_module_without_file_is_not_resolved(self): fake_main = types.ModuleType('__main__') self.ass...
Auto-reloading with StatReloader very intermittently throws "ValueError: embedded null byte". Description Raising this mainly so that it's tracked, as I have no idea how to reproduce it, nor why it's happening. It ultimately looks like a problem with Pathlib, which wasn't used prior to 2.2. Stacktrace: Traceback (mos...
Thanks for the report, however as you've admitted there is too many unknowns to accept this ticket. I don't believe that it is related with pathlib, maybe samba connection is unstable it's hard to tell. I don't believe that it is related with pathlib Well ... it definitely is, you can see that from the stacktrace. The ...
2019-07-21T20:56:14Z
3
["test_path_with_embedded_null_bytes (utils_tests.test_autoreload.TestIterModulesAndFiles)", "test_paths_are_pathlib_instances (utils_tests.test_autoreload.TestIterModulesAndFiles)"]
[".pyc and .pyo files are included in the files list.", "iter_all_python_module_file() ignores weakref modules.", "test_calls_start_django (utils_tests.test_autoreload.RunWithReloaderTests)", "test_calls_sys_exit (utils_tests.test_autoreload.RunWithReloaderTests)", "test_check_errors (utils_tests.test_autoreload.TestIt...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11584
fed5e19369f456e41f0768f4fb92602af027a46d
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -240,8 +240,15 @@ def __init__(self): def watch_dir(self, path, glob): path = Path(path) - if not path.is_absolute(): - raise ValueError('%s must be...
diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py --- a/tests/utils_tests/test_autoreload.py +++ b/tests/utils_tests/test_autoreload.py @@ -499,6 +499,12 @@ def test_overlapping_glob_recursive(self, mocked_modules, notify_mock): class BaseReloaderTests(ReloaderTests): RELOAD...
[FATAL] FileNotFoundError with runserver command inside Docker container Description Summary Trying to run the development server in a container with volume-mounted source is throwing a FileNotFoundError. I've verified that the issue is consistently reproducible with Django==2.2.3 and not present in Django==2.1.4. Tr...
First glance, this looks like some Docker weirdness: File "/usr/local/lib/python3.6/site-packages/django/utils/translation/reloader.py", line 16, in watch_for_translation_changes absolute_path = path.absolute() File "/usr/local/lib/python3.6/pathlib.py", line 1129, in absolute obj = self._from_parts([os.getcwd()] + sel...
2019-07-21T21:31:31Z
3
["test_watch_dir_with_unresolvable_path (utils_tests.test_autoreload.BaseReloaderTests)"]
[".pyc and .pyo files are included in the files list.", "iter_all_python_module_file() ignores weakref modules.", "test_calls_start_django (utils_tests.test_autoreload.RunWithReloaderTests)", "test_calls_sys_exit (utils_tests.test_autoreload.RunWithReloaderTests)", "test_check_errors (utils_tests.test_autoreload.TestIt...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11592
806ba19bbff311b7d567857ae61db6ff84af4a2c
diff --git a/django/core/handlers/wsgi.py b/django/core/handlers/wsgi.py --- a/django/core/handlers/wsgi.py +++ b/django/core/handlers/wsgi.py @@ -141,7 +141,7 @@ def __call__(self, environ, start_response): ] start_response(status, response_headers) if getattr(response, 'file_to_stream', Non...
diff --git a/tests/wsgi/tests.py b/tests/wsgi/tests.py --- a/tests/wsgi/tests.py +++ b/tests/wsgi/tests.py @@ -3,6 +3,7 @@ from django.core.signals import request_started from django.core.wsgi import get_wsgi_application from django.db import close_old_connections +from django.http import FileResponse from django.t...
Start passing FileResponse.block_size to wsgi.file_wrapper. Description (last modified by Chris Jerdonek) I noticed that Django's FileResponse class has a block_size attribute which can be customized by subclassing: ​https://github.com/django/django/blob/415e899dc46c2f8d667ff11d3e54eff759eaded4/django/http/resp...
Seems reasonable, Thanks (see ​example-of-wrapper-usage).
2019-07-24T17:10:08Z
3
["test_file_wrapper (wsgi.tests.WSGITest)"]
["test_bad_module (wsgi.tests.GetInternalWSGIApplicationTest)", "test_bad_name (wsgi.tests.GetInternalWSGIApplicationTest)", "test_default (wsgi.tests.GetInternalWSGIApplicationTest)", "test_get_wsgi_application (wsgi.tests.WSGITest)", "test_success (wsgi.tests.GetInternalWSGIApplicationTest)"]
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11605
194d1dfc186cc8d2b35dabf64f3ed38b757cbd98
diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -500,8 +500,6 @@ def as_sql(self, compiler, connection): @deconstructible class F(Combinable): """An object capable of resolving references to existing que...
diff --git a/tests/expressions_window/tests.py b/tests/expressions_window/tests.py --- a/tests/expressions_window/tests.py +++ b/tests/expressions_window/tests.py @@ -4,7 +4,8 @@ from django.core.exceptions import FieldError from django.db import NotSupportedError, connection from django.db.models import ( - F, O...
Filter by window expression should raise a descriptive error. Description Django has a check that filter does not contain window expressions. But it is shallow, neither right side of the expression nor combined expressions are checked. class Employee(models.Model): grade = models.IntegerField() # raises NotSupporte...
Thanks for this report. Agreed, we should raise a helpful message because it is currently unsupported (see also a ticket #28333 to support this feature). ​PR
2019-07-29T11:52:50Z
3
["test_invalid_filter (expressions_window.tests.NonQueryWindowTests)"]
["A query with RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING.", "An alternative way to specify a query for FirstValue.", "Window expressions can't be used in an INSERT statement.", "Window expressions can't be used in an UPDATE statement.", "test_avg_salary_department (expressions_window.tests.WindowFunctio...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11630
65e86948b80262574058a94ccaae3a9b59c3faea
diff --git a/django/core/checks/model_checks.py b/django/core/checks/model_checks.py --- a/django/core/checks/model_checks.py +++ b/django/core/checks/model_checks.py @@ -4,7 +4,8 @@ from itertools import chain from django.apps import apps -from django.core.checks import Error, Tags, register +from django.conf impo...
diff --git a/tests/check_framework/test_model_checks.py b/tests/check_framework/test_model_checks.py --- a/tests/check_framework/test_model_checks.py +++ b/tests/check_framework/test_model_checks.py @@ -1,12 +1,16 @@ from django.core import checks -from django.core.checks import Error +from django.core.checks import E...
Django throws error when different apps with different models have the same name table name. Description Error message: table_name: (models.E028) db_table 'table_name' is used by multiple models: base.ModelName, app2.ModelName. We have a Base app that points to a central database and that has its own tables. We then ...
Regression in [5d25804eaf81795c7d457e5a2a9f0b9b0989136c], ticket #20098. My opinion is that as soon as the project has a non-empty DATABASE_ROUTERS setting, the error should be turned into a warning, as it becomes difficult to say for sure that it's an error. And then the project can add the warning in SILENCED_SYSTEM_...
2019-08-05T11:22:41Z
3
["test_collision_across_apps_database_routers_installed (check_framework.test_model_checks.DuplicateDBTableTests)", "test_collision_in_same_app_database_routers_installed (check_framework.test_model_checks.DuplicateDBTableTests)"]
["test_collision_abstract_model (check_framework.test_model_checks.ConstraintNameTests)", "test_collision_abstract_model (check_framework.test_model_checks.IndexNameTests)", "test_collision_across_apps (check_framework.test_model_checks.ConstraintNameTests)", "test_collision_across_apps (check_framework.test_model_chec...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11727
44077985f58be02214a11ffde35776fed3c960e1
diff --git a/django/contrib/admin/templatetags/admin_modify.py b/django/contrib/admin/templatetags/admin_modify.py --- a/django/contrib/admin/templatetags/admin_modify.py +++ b/django/contrib/admin/templatetags/admin_modify.py @@ -54,12 +54,20 @@ def submit_row(context): is_popup = context['is_popup'] save_as...
diff --git a/tests/admin_views/test_templatetags.py b/tests/admin_views/test_templatetags.py --- a/tests/admin_views/test_templatetags.py +++ b/tests/admin_views/test_templatetags.py @@ -29,6 +29,25 @@ def test_submit_row(self): self.assertIs(template_context['extra'], True) self.assertIs(template_con...
Allow hiding the "Save and Add Another" button with a `show_save_and_add_another` context variable Description To provide better adjustability, to introduce new context var - show_save_and_add_another. E.g. if I want to hide button "Save and add another", I can just modify extra_context - write False to the variable....
​PR The options for Save and Save and continue were originally added to ensure correct behaviour when hitting Save New and getting a validation error. See ​0894643e4. They weren't really for direct usage... ... however, maybe it's reasonable. Tentatively Accept to see how the patch turns out, and what others think. Thi...
2019-08-29T14:32:01Z
3.1
["test_override_show_save_and_add_another (admin_views.test_templatetags.AdminTemplateTagsTest)", "test_submit_row (admin_views.test_templatetags.AdminTemplateTagsTest)"]
["test_choice_links (admin_views.test_templatetags.DateHierarchyTests)", "test_override_change_form_template_tags (admin_views.test_templatetags.AdminTemplateTagsTest)", "test_override_change_list_template_tags (admin_views.test_templatetags.AdminTemplateTagsTest)"]
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-11742
fee75d2aed4e58ada6567c464cfd22e89dc65f4a
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -257,6 +257,7 @@ def is_value(value, accept_promise=True): ) ] + choice_max_length = 0 # Expect [g...
diff --git a/tests/invalid_models_tests/test_ordinary_fields.py b/tests/invalid_models_tests/test_ordinary_fields.py --- a/tests/invalid_models_tests/test_ordinary_fields.py +++ b/tests/invalid_models_tests/test_ordinary_fields.py @@ -304,6 +304,32 @@ class Model(models.Model): self.assertEqual(Model._meta.g...
Add check to ensure max_length fits longest choice. Description There is currently no check to ensure that Field.max_length is large enough to fit the longest value in Field.choices. This would be very helpful as often this mistake is not noticed until an attempt is made to save a record with those values that are to...
null
2019-09-04T08:30:14Z
3
["test_choices_in_max_length (invalid_models_tests.test_ordinary_fields.CharFieldTests)", "test_choices_named_group (invalid_models_tests.test_ordinary_fields.CharFieldTests)"]
["Two letters isn't a valid choice pair.", "test_auto_now_and_auto_now_add_raise_error (invalid_models_tests.test_ordinary_fields.DateFieldTests)", "test_bad_db_index_value (invalid_models_tests.test_ordinary_fields.CharFieldTests)", "test_bad_max_length_value (invalid_models_tests.test_ordinary_fields.CharFieldTests)"...
419a78300f7cd27611196e1e464d50fd0385ff27
django/django
django__django-11790
b1d6b35e146aea83b171c1b921178bbaae2795ed
diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py --- a/django/contrib/auth/forms.py +++ b/django/contrib/auth/forms.py @@ -191,7 +191,9 @@ def __init__(self, request=None, *args, **kwargs): # Set the max length and label for the "username" field. self.username_field = UserMod...
diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py --- a/tests/auth_tests/test_forms.py +++ b/tests/auth_tests/test_forms.py @@ -423,6 +423,7 @@ def test_username_field_max_length_matches_user_model(self): CustomEmailField.objects.create_user(**data) form = AuthenticationForm...
AuthenticationForm's username field doesn't set maxlength HTML attribute. Description AuthenticationForm's username field doesn't render with maxlength HTML attribute anymore. Regression introduced in #27515 and 5ceaf14686ce626404afb6a5fbd3d8286410bf13. ​https://groups.google.com/forum/?utm_source=digest&utm_medium=e...
Regression test.
2019-09-17T14:33:44Z
3.1
["test_username_field_max_length_defaults_to_254 (auth_tests.test_forms.AuthenticationFormTest)", "test_username_field_max_length_matches_user_model (auth_tests.test_forms.AuthenticationFormTest)"]
["An invalid login doesn't leak the inactive status of a user.", "The change form does not return the password value", "UserCreationForm password validation uses all of the form's data.", "test_both_passwords (auth_tests.test_forms.UserCreationFormTest)", "test_bug_14242 (auth_tests.test_forms.UserChangeFormTest)", "te...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-11815
e02f67ef2d03d48128e7a118bf75f0418e24e8ac
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 @@ -120,9 +120,10 @@ class EnumSerializer(BaseSerializer): def serialize(self): enum_class = self.value.__class__ module = enum_cl...
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 @@ -257,6 +257,10 @@ class TextEnum(enum.Enum): A = 'a-value' B = 'value-b' + class TextTranslatedEnum(enum.Enum): + A ...
Migrations uses value of enum object instead of its name. Description (last modified by oasl) When using Enum object as a default value for a CharField, the generated migration file uses the value of the Enum object instead of the its name. This causes a problem when using Django translation on the value of the...
Thanks for this report, however I'm not sure how translated values can brake migrations. Can you provide a sample project to reproduce this issue? Migrations with translatable strings works fine for me: >>> class TextEnum(enum.Enum): ... C = _('translatable value') ... >>> TextEnum(_('translatable value')) <TextEnum.C:...
2019-09-24T21:45:36Z
3.1
["test_serialize_class_based_validators (migrations.test_writer.WriterTests)", "test_serialize_enums (migrations.test_writer.WriterTests)"]
["A reference in a local scope can't be serialized.", "An unbound method used within a class body can be serialized.", "test_args_kwargs_signature (migrations.test_writer.OperationWriterTests)", "test_args_signature (migrations.test_writer.OperationWriterTests)", "test_custom_operation (migrations.test_writer.WriterTes...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-11820
c2678e49759e5c4c329bff0eeca2886267005d21
diff --git a/django/db/models/base.py b/django/db/models/base.py --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -1708,9 +1708,15 @@ def _check_ordering(cls): fld = None for part in field.split(LOOKUP_SEP): try: - fld = _cls._meta.get_field(...
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py --- a/tests/invalid_models_tests/test_models.py +++ b/tests/invalid_models_tests/test_models.py @@ -814,6 +814,26 @@ class Meta: ) ]) + def test_ordering_pointing_multiple_times_to_model_fields(...
models.E015 is raised when Meta.ordering contains "pk" of a related field. Description models.E015 is raised when Meta.ordering contains __pk of a related field, e.g.: test_app.SomeModel: (models.E015) 'ordering' refers to the nonexistent field, related field, or lookup 'option__pk'. Regression in 440505cb2cadbe1a5b9...
Regression test. Thanks @felixxm for the test. I will prepare a fix for it.
2019-09-26T08:37:14Z
3.1
["test_ordering_pointing_multiple_times_to_model_fields (invalid_models_tests.test_models.OtherModelTests)", "test_ordering_pointing_to_related_model_pk (invalid_models_tests.test_models.OtherModelTests)"]
["test_check_constraints (invalid_models_tests.test_models.ConstraintsTests)", "test_check_constraints_required_db_features (invalid_models_tests.test_models.ConstraintsTests)", "test_db_column_clash (invalid_models_tests.test_models.FieldNamesTests)", "test_ending_with_underscore (invalid_models_tests.test_models.Fiel...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-11893
0f843fdd5b9b2f2307148465cd60f4e1b2befbb4
diff --git a/django/forms/fields.py b/django/forms/fields.py --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -25,7 +25,7 @@ URLInput, ) from django.utils import formats -from django.utils.dateparse import parse_duration +from django.utils.dateparse import parse_datetime, parse_duration from django....
diff --git a/tests/forms_tests/field_tests/test_datetimefield.py b/tests/forms_tests/field_tests/test_datetimefield.py --- a/tests/forms_tests/field_tests/test_datetimefield.py +++ b/tests/forms_tests/field_tests/test_datetimefield.py @@ -2,6 +2,7 @@ from django.forms import DateTimeField, ValidationError from djan...
DateTimeField doesn't accept ISO 8601 formatted date string Description DateTimeField doesn't accept ISO 8601 formatted date string. Differene is that ISO format allows date and time separator to be capital T letter. (Format being YYYY-MM-DDTHH:MM:SS. Django expects to have only space as a date and time separator.
ISO8601 is a good machine format, but not a particularly nice human readable format. Form processing is primarily about human-readable input. If you disagree, the DateTimeField input formats are configurable (DATETIME_INPUT_FORMATS), so you can add ISO8601 format in your own projects if you want. I think the problem ca...
2019-10-09T10:14:53Z
3.1
["Localized DateTimeFields with manually specified input formats can accept those formats", "test_datetimefield_clean (forms_tests.field_tests.test_datetimefield.DateTimeFieldTest)", "test_datetimefield_clean_input_formats (forms_tests.field_tests.test_datetimefield.DateTimeFieldTest)", "test_datetimefield_clean_invali...
["DateFields can parse dates in the default format", "DateFields with manually specified input formats can accept those formats", "DateTimeFields can parse dates in the default format", "DateTimeFields with manually specified input formats can accept those formats", "Localized DateFields act as unlocalized widgets", "L...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-11903
dee687e93a2d45e9fac404be2098cc4707d31c1f
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -229,7 +229,7 @@ def fetch_command(self, subcommand): # (get_commands() swallows the original one) so the user is # ...
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 @@ -634,6 +634,15 @@ def test_builtin_with_environment(self): # of the generated manage.py script ########################################################################## ...
ManagementUtility.fetch_command prints "No Django settings specified." even if they are. Description fetch_command(...) currently ​does the following: if os.environ.get('DJANGO_SETTINGS_MODULE'): # If `subcommand` is missing due to misconfigured settings, the # following line will retrigger an ImproperlyConfigured ...
This is some sensible part of code which was altered a few times already. I guess the test suite should tell you if you can use settings.configured in that line. Hi Keryn. startproject and startapp (at least) can bypass that if settings.configured check in execute() that you link, so we can get to fetch_command() witho...
2019-10-11T14:46:51Z
3.1
["test_non_existent_command_output (admin_scripts.tests.ManageManullyConfiguredSettings)"]
["\"", "--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...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-11964
fc2b1cc926e34041953738e58fa6ad3053059b22
diff --git a/django/db/models/enums.py b/django/db/models/enums.py --- a/django/db/models/enums.py +++ b/django/db/models/enums.py @@ -60,7 +60,13 @@ def values(cls): class Choices(enum.Enum, metaclass=ChoicesMeta): """Class for creating enumerated choices.""" - pass + + def __str__(self): + """ + ...
diff --git a/tests/model_enums/tests.py b/tests/model_enums/tests.py --- a/tests/model_enums/tests.py +++ b/tests/model_enums/tests.py @@ -143,6 +143,12 @@ class Fruit(models.IntegerChoices): APPLE = 1, 'Apple' PINEAPPLE = 1, 'Pineapple' + def test_str(self): + for test in ...
The value of a TextChoices/IntegerChoices field has a differing type Description If we create an instance of a model having a CharField or IntegerField with the keyword choices pointing to IntegerChoices or TextChoices, the value returned by the getter of the field will be of the same type as the one created by enum....
Hi NyanKiyoshi, what a lovely report. Thank you. Clearly :) the expected behaviour is that test_created_object_is_str should pass. It's interesting that the underlying __dict__ values differ, which explains all I guess: Created: {'_state': <django.db.models.base.ModelState object at 0x10730efd0>, 'id': 1, 'my_str_value...
2019-10-23T14:16:45Z
3.1
["test_str (model_enums.tests.ChoicesTests)", "test_textchoices (model_enums.tests.ChoicesTests)"]
["test_bool_unsupported (model_enums.tests.CustomChoicesTests)", "test_integerchoices (model_enums.tests.ChoicesTests)", "test_integerchoices_auto_label (model_enums.tests.ChoicesTests)", "test_integerchoices_containment (model_enums.tests.ChoicesTests)", "test_integerchoices_empty_label (model_enums.tests.ChoicesTests...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12009
82a88d2f48e13ef5d472741d5ed1c183230cfe4c
diff --git a/django/bin/django-admin.py b/django/bin/django-admin.py --- a/django/bin/django-admin.py +++ b/django/bin/django-admin.py @@ -1,5 +1,21 @@ #!/usr/bin/env python +# When the django-admin.py deprecation ends, remove this script. +import warnings + from django.core import management +try: + from django...
diff --git a/tests/admin_scripts/test_django_admin_py.py b/tests/admin_scripts/test_django_admin_py.py new file mode 100644 --- /dev/null +++ b/tests/admin_scripts/test_django_admin_py.py @@ -0,0 +1,37 @@ +import subprocess +import sys +from pathlib import Path + +import django +from django.test import SimpleTestCase +...
Django installs /usr/bin/django-admin and /usr/bin/django-admin.py Description Django (since 1.7) installs /usr/bin/django-admin and /usr/bin/django-admin.py. Both of them execute django.core.management.execute_from_command_line(). /usr/bin/django-admin.py does it directly, while /usr/bin/django-admin does it through...
We've introduced django-admin because commands don't usually have "language extensions". We're keeping django-admin.py for backwards-compatibility. There's little benefit to remove django-admin.py and it would be very disruptive. Maybe we'll do to at some point, but not soon. We should wait until support for Django 1.6...
2019-11-02T04:49:18Z
3.1
["test_django_admin_py_deprecated (admin_scripts.test_django_admin_py.DeprecationTests)"]
["\"", "--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...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12049
24b9f5082344a127147266dd52d5d2dcd1c9cb44
diff --git a/django/db/migrations/executor.py b/django/db/migrations/executor.py --- a/django/db/migrations/executor.py +++ b/django/db/migrations/executor.py @@ -329,8 +329,11 @@ def should_skip_detecting_model(migration, model): apps = after_state.apps found_create_model_migration = False f...
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 @@ -14,7 +14,7 @@ from django.db.backends.utils import truncate_name from django.db.migrations.exceptions import InconsistentMigrationHistory from django....
Applied migration detection may fail when using a case-insensitive collation Description (last modified by Tim Graham) Hello, I'm using this guide ​https://datascience.blog.wzb.eu/2017/03/21/using-django-with-an-existinglegacy-database for my studies with camelCasing together with Django (yes, I'm still trying...
Not sure about the solution. PR just created for proposing the solution. Left a few comments for improvements.
2019-11-08T23:50:59Z
3.1
["test_migrate_fake_initial_case_insensitive (migrations.test_commands.MigrateTests)"]
["--squashed-name also works if a start migration is omitted.", "--squashed-name specifies the new migration's name.", "Migration directories without an __init__.py file are allowed.", "Tests migrate --plan output.", "test_ambiguous_prefix (migrations.test_commands.MigrateTests)", "test_app_without_migrations (migratio...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12091
5d654e1e7104d2ce86ec1b9fe52865a7dca4b4be
diff --git a/django/http/request.py b/django/http/request.py --- a/django/http/request.py +++ b/django/http/request.py @@ -1,6 +1,7 @@ import cgi import codecs import copy +import warnings from io import BytesIO from itertools import chain from urllib.parse import quote, urlencode, urljoin, urlsplit @@ -15,6 +16,...
diff --git a/tests/requests/test_is_ajax_deprecations.py b/tests/requests/test_is_ajax_deprecations.py new file mode 100644 --- /dev/null +++ b/tests/requests/test_is_ajax_deprecations.py @@ -0,0 +1,12 @@ +from django.http import HttpRequest +from django.test import SimpleTestCase, ignore_warnings +from django.utils.de...
Deprecate HttpRequest.is_ajax. Description (last modified by Mariusz Felisiak) As discussed on ​this django-developers thread this should be deprecated. It inspects the non-standard header X-Requested-Wiith that is set by jQuery and maybe other frameworks. However jQuery's popularity, especially for making requ...
The first step would be to document current limitations of the method. Second step would be to avoid using it as much as possible in Django's own code. Finally the deprecation can take place. It remains to be shown how the ​request.accepts proposal can play a role here. A good exercise would be to replace that example:...
2019-11-18T08:31:16Z
3.1
["test_non_english_default_english_userpref (view_tests.tests.test_i18n.I18NViewTests)", "test_non_html_response_encoding (view_tests.tests.test_debug.NonHTMLResponseExceptionReporterFilter)", "test_setlang_doesnt_perform_a_default_redirect_for_ajax (view_tests.tests.test_i18n.SetLanguageTests)", "test_setlang_doesnt_p...
["A message can be provided in addition to a request", "A simple exception report can be generated", "An exception report can be generated even for a disallowed host.", "An exception report can be generated for just a request", "An exception report can be generated without request", "Large values should not create a la...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12125
89d41cba392b759732ba9f1db4ff29ed47da6a56
diff --git a/django/db/migrations/serializer.py b/django/db/migrations/serializer.py --- a/django/db/migrations/serializer.py +++ b/django/db/migrations/serializer.py @@ -269,7 +269,7 @@ def serialize(self): if module == builtins.__name__: return self.value.__name__, set() els...
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py --- a/tests/migrations/test_writer.py +++ b/tests/migrations/test_writer.py @@ -26,6 +26,11 @@ from .models import FoodManager, FoodQuerySet +class DeconstructibleInstances: + def deconstruct(self): + return ('DeconstructibleI...
makemigrations produces incorrect path for inner classes Description When you define a subclass from django.db.models.Field as an inner class of some other class, and use this field inside a django.db.models.Model class, then when you run manage.py makemigrations, a migrations file is created which refers to the inne...
This should be possible to do by relying on __qualname__ (instead of __name__) now that master is Python 3 only. ​PR I think we should focus on using __qualname__ during migration serialization as well instead of simply solving the field subclasses case. In fb0f987: Fixed #27914 -- Added support for nested classes in F...
2019-11-22T12:55:45Z
3.1
["test_serialize_nested_class (migrations.test_writer.WriterTests)", "test_serialize_numbers (migrations.test_writer.WriterTests)"]
["A reference in a local scope can't be serialized.", "An unbound method used within a class body can be serialized.", "test_args_kwargs_signature (migrations.test_writer.OperationWriterTests)", "test_args_signature (migrations.test_writer.OperationWriterTests)", "test_custom_operation (migrations.test_writer.WriterTes...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12143
5573a54d409bb98b5c5acdb308310bed02d392c2
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -1631,7 +1631,9 @@ def change_view(self, request, object_id, form_url='', extra_context=None): def _get_edited_object_pks(self, request, prefix): ...
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 @@ -844,6 +844,26 @@ def test_get_list_editable_queryset(self): queryset = m._get_list_editable_queryset(request, prefix='form') self.assertEqual(q...
Possible data loss in admin changeform view when using regex special characters in formset prefix Description (last modified by Baptiste Mispelon) While browsing the code in admin/options.py [1] (working on an unrelated ticket), I came across that line: pk_pattern = re.compile(r'{}-\d+-{}$'.format(prefix, self....
null
2019-11-25T14:38:30Z
3.1
["test_get_list_editable_queryset_with_regex_chars_in_prefix (admin_changelist.tests.ChangeListTests)"]
["#15185 -- Allow no links from the 'change list' view grid.", "list_editable edits use a filtered queryset to limit memory usage.", "test_builtin_lookup_in_search_fields (admin_changelist.tests.ChangeListTests)", "test_changelist_search_form_validation (admin_changelist.tests.ChangeListTests)", "test_computed_list_dis...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12148
c9bf1910e2c1a72244dbd1e3dd9a3ff7215b8b4a
diff --git a/django/contrib/flatpages/models.py b/django/contrib/flatpages/models.py --- a/django/contrib/flatpages/models.py +++ b/django/contrib/flatpages/models.py @@ -1,6 +1,6 @@ from django.contrib.sites.models import Site from django.db import models -from django.urls import get_script_prefix +from django.urls ...
diff --git a/tests/flatpages_tests/absolute_urls.py b/tests/flatpages_tests/absolute_urls.py new file mode 100644 --- /dev/null +++ b/tests/flatpages_tests/absolute_urls.py @@ -0,0 +1,6 @@ +from django.contrib.flatpages import views +from django.urls import path + +urlpatterns = [ + path('flatpage/', views.flatpage,...
reverse() and get_absolute_url() may return different values for same FlatPage Description (last modified by Tim Graham) The FlatPage model implements get_absolute_url() without using reverse(). The comment suggests, that this handles SCRIPT_NAME issues, but the link in the admin interface does not work, if you...
The implementation is intended to match the catchall middleware. We could try reversing and only if that fails fall back to the current logic. I just sent a pull request for a fix for this: ​https://github.com/django/django/pull/2554 This solves all the cases I can think of for including flatpages and running get_absol...
2019-11-26T23:08:25Z
3.1
["test_flatpage_sitemap (flatpages_tests.test_sitemaps.FlatpagesSitemapTests)", "test_get_absolute_url_include (flatpages_tests.test_models.FlatpageModelTests)", "test_get_absolute_url_include_no_slash (flatpages_tests.test_models.FlatpageModelTests)", "test_get_absolute_url_with_hardcoded_url (flatpages_tests.test_mod...
["test_get_absolute_url_honors_script_prefix (flatpages_tests.test_models.FlatpageModelTests)", "test_get_absolute_url_urlencodes (flatpages_tests.test_models.FlatpageModelTests)", "test_str (flatpages_tests.test_models.FlatpageModelTests)"]
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12193
3fb7c12158a2402f0f80824f6778112071235803
diff --git a/django/forms/widgets.py b/django/forms/widgets.py --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -522,9 +522,7 @@ def format_value(self, value): def get_context(self, name, value, attrs): if self.check_test(value): - if attrs is None: - attrs = {} -...
diff --git a/tests/forms_tests/widget_tests/test_checkboxinput.py b/tests/forms_tests/widget_tests/test_checkboxinput.py --- a/tests/forms_tests/widget_tests/test_checkboxinput.py +++ b/tests/forms_tests/widget_tests/test_checkboxinput.py @@ -89,3 +89,8 @@ def test_value_from_datadict_string_int(self): def test_va...
SplitArrayField with BooleanField always has widgets checked after the first True value. Description (last modified by Peter Andersen) When providing a SplitArrayField BooleanField with preexisting data, the final_attrs dict is updated to include 'checked': True after the for loop has reached the first True val...
Changes available here: ​https://github.com/django/django/pull/12193 Thanks for the report. Reproduced at 5708327c3769262b845730996ca2784245ada4d1.
2019-12-08T01:38:25Z
3.1
["test_get_context_does_not_mutate_attrs (forms_tests.widget_tests.test_checkboxinput.CheckboxInputTest)"]
["test_render_check_exception (forms_tests.widget_tests.test_checkboxinput.CheckboxInputTest)", "test_render_check_test (forms_tests.widget_tests.test_checkboxinput.CheckboxInputTest)", "test_render_empty (forms_tests.widget_tests.test_checkboxinput.CheckboxInputTest)", "test_render_false (forms_tests.widget_tests.test...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12198
d6505273cd889886caca57884fa79941b18c2ea6
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 @@ -63,8 +63,9 @@ def authenticate(request=None, **credentials): If the given credentials are valid, return a User object. """ for backend, backend_pa...
diff --git a/tests/auth_tests/test_auth_backends.py b/tests/auth_tests/test_auth_backends.py --- a/tests/auth_tests/test_auth_backends.py +++ b/tests/auth_tests/test_auth_backends.py @@ -13,6 +13,7 @@ from django.test import ( SimpleTestCase, TestCase, modify_settings, override_settings, ) +from django.views.dec...
Allow sensitive_variables() to preserve the signature of its decorated function Description When the method authenticate of a custom AuthenticationBackend is decorated with sensitive_variables, inspect.getcallargs will always match. Calling the authenticate function will attempt to call this backend with any set of c...
Could you please try ​bisecting to find the commit where the behavior changed? It is commit b89c2a5d9eb70ca36629ef657c98e3371e9a5c4f. Thanks! I'm not sure what can be done to fix this. Any ideas? Nothing apart from going back to the previous masking of TypeError... I think that these two behaviours go against each othe...
2019-12-09T16:59:47Z
3.1
["test_skips_backends_with_decorated_method (auth_tests.test_auth_backends.AuthenticateTests)"]
["A TypeError within a backend is propagated properly (#18171).", "A superuser has all permissions. Refs #14795.", "Hasher is run once regardless of whether the user exists. Refs #20760.", "Regressiontest for #12462", "test_anonymous_has_no_permissions (auth_tests.test_auth_backends.CustomPermissionsUserModelBackendTes...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12209
5a68f024987e6d16c2626a31bf653a2edddea579
diff --git a/django/db/models/base.py b/django/db/models/base.py --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -849,6 +849,7 @@ def _save_table(self, raw=False, cls=None, force_insert=False, updated = False # Skip an UPDATE when adding an instance and primary key has a default. ...
diff --git a/tests/serializers/models/data.py b/tests/serializers/models/data.py --- a/tests/serializers/models/data.py +++ b/tests/serializers/models/data.py @@ -4,6 +4,8 @@ NULL values, where allowed. The basic idea is to have a model for each Django data type. """ +import uuid + from django.contrib.contenttypes....
Change in behaviour when saving a model instance with an explcit pk value if the pk field has a default Description (last modified by Reupen Shah) Consider the following model: from uuid import uuid4 from django.db import models class Sample(models.Model): id = models.UUIDField(primary_key=True, default=uuid4)...
It looks like ​the logic in _save_table should not force an insert if an explicit pk value is provided. The logic should likely take pk_set into account if ( not pk_set and self._state.adding and self._meta.pk.default and self._meta.pk.default is not NOT_PROVIDED ): force_insert = True I'm surprised this was not caught...
2019-12-12T04:11:05Z
3.1
["partial(func, *args, **keywords) - new function with partial application"]
[]
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12262
69331bb851c34f05bc77e9fc24020fe6908b9cd5
diff --git a/django/template/library.py b/django/template/library.py --- a/django/template/library.py +++ b/django/template/library.py @@ -261,7 +261,7 @@ def parse_bits(parser, bits, params, varargs, varkw, defaults, if kwarg: # The kwarg was successfully extracted param, value = kwa...
diff --git a/tests/template_tests/templatetags/inclusion.py b/tests/template_tests/templatetags/inclusion.py --- a/tests/template_tests/templatetags/inclusion.py +++ b/tests/template_tests/templatetags/inclusion.py @@ -136,6 +136,15 @@ def inclusion_one_default(one, two='hi'): inclusion_one_default.anything = "Expecte...
Custom template tags raise TemplateSyntaxError when keyword-only arguments with defaults are provided. Description (last modified by P-Seebauer) When creating simple tags without variable keyword args, but an keyword argument with a default value. It's not possible to supply any other variable. @register.simple...
null
2019-12-30T13:13:59Z
3.1
["test_inclusion_tag_errors (template_tests.test_custom.InclusionTagTests)", "test_inclusion_tags (template_tests.test_custom.InclusionTagTests)", "test_simple_tag_errors (template_tests.test_custom.SimpleTagTests)", "test_simple_tags (template_tests.test_custom.SimpleTagTests)"]
["test_15070_use_l10n (template_tests.test_custom.InclusionTagTests)", "test_decorated_filter (template_tests.test_custom.CustomFilterTests)", "test_filter (template_tests.test_custom.CustomFilterTests)", "test_include_tag_missing_context (template_tests.test_custom.InclusionTagTests)", "test_inclusion_tag_registration...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12281
e2d9d66a22f9004c0349f6aa9f8762fa558bdee8
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 @@ -1,3 +1,4 @@ +import collections from itertools import chain from django.apps import apps @@ -985,15 +986,20 @@ def _check_action_permission_methods(self, obj): ...
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 @@ -1441,9 +1441,8 @@ class BandAdmin(ModelAdmin): self.assertIsInvalid( BandAdmin, Band, - "__name__ attributes of actions define...
admin.E130 (duplicate __name__ attributes of actions) should specify which were duplicated. Description The fact that the __name__ is used is somewhat an implementation detail, and there's no guarantee the user has enough of an understanding of python to know what that attribute is, let alone how to fix it. This just...
Agreed, we can add names of duplicated actions to this message. Hey! I am new to django contribution and I want to solve this issue. I want to know that error message of duplicates should write after the error of unique name in the same function ?
2020-01-06T11:14:37Z
3.1
["test_actions_not_unique (modeladmin.test_checks.ActionsCheckTests)"]
["test_None_is_valid_case (modeladmin.test_checks.ListDisplayLinksCheckTests)", "test_actions_unique (modeladmin.test_checks.ActionsCheckTests)", "test_autocomplete_e036 (modeladmin.test_checks.AutocompleteFieldsTests)", "test_autocomplete_e037 (modeladmin.test_checks.AutocompleteFieldsTests)", "test_autocomplete_e039 ...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12306
8b3e714ecf409ed6c9628c3f2a4e033cbfa4253b
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -269,10 +269,10 @@ def _check_choices(self): ): break if self.max_length is not None and gr...
diff --git a/tests/invalid_models_tests/test_ordinary_fields.py b/tests/invalid_models_tests/test_ordinary_fields.py --- a/tests/invalid_models_tests/test_ordinary_fields.py +++ b/tests/invalid_models_tests/test_ordinary_fields.py @@ -1,4 +1,5 @@ import unittest +import uuid from django.core.checks import Error, Wa...
Named groups in choices are not properly validated in case of non str typed values. Description In case of using typed choices and string value to store it (in my case it is multiple values stored in char field as JSON) it is possible to catch error while run makemigrations (_check_choices error): main.MultiValueFiel...
Thanks for this report. Regression in b6251956b69512bf230322bd7a49b629ca8455c6.
2020-01-10T19:36:24Z
3.1
["test_choices_named_group (invalid_models_tests.test_ordinary_fields.UUIDFieldTests)"]
["Two letters isn't a valid choice pair.", "test_auto_now_and_auto_now_add_raise_error (invalid_models_tests.test_ordinary_fields.DateFieldTests)", "test_bad_db_index_value (invalid_models_tests.test_ordinary_fields.CharFieldTests)", "test_bad_max_length_value (invalid_models_tests.test_ordinary_fields.CharFieldTests)"...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12325
29c126bb349526b5f1cd78facbe9f25906f18563
diff --git a/django/db/models/base.py b/django/db/models/base.py --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -202,7 +202,7 @@ def __new__(cls, name, bases, attrs, **kwargs): continue # Locate OneToOneField instances. for field in base._meta.local_fields: -...
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py --- a/tests/invalid_models_tests/test_models.py +++ b/tests/invalid_models_tests/test_models.py @@ -3,7 +3,6 @@ from django.conf import settings from django.core.checks import Error, Warning from django.core.checks.mod...
pk setup for MTI to parent get confused by multiple OneToOne references. Description class Document(models.Model): pass class Picking(Document): document_ptr = models.OneToOneField(Document, on_delete=models.CASCADE, parent_link=True, related_name='+') origin = models.OneToOneField(Document, related_name='picking'...
That seems to be a bug, managed to reproduce. Does the error go away if you add primary_key=True to document_ptr like I assume you wanted to do? This makes me realized that the ​MTI documentation is not completely correcy, ​the automatically added `place_ptr` field end up with `primary_key=True`. Not sure why we're not...
2020-01-15T14:02:25Z
3.1
["test_clash_parent_link (invalid_models_tests.test_relative_fields.ComplexClashTests)", "test_onetoone_with_parent_model (invalid_models_tests.test_models.OtherModelTests)"]
["Ref #22047.", "test_abstract_base (migrations.test_state.RelatedModelsTests)", "test_abstract_model_children_inherit_indexes (migrations.test_state.ModelStateTests)", "test_accessor_clash (invalid_models_tests.test_relative_fields.SelfReferentialFKClashTests)", "test_accessor_clash (invalid_models_tests.test_relative...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12430
20ba3ce4ac8e8438070568ffba76f7d8d4986a53
diff --git a/django/core/cache/__init__.py b/django/core/cache/__init__.py --- a/django/core/cache/__init__.py +++ b/django/core/cache/__init__.py @@ -12,7 +12,7 @@ See docs/topics/cache.txt for information on the public API. """ -from threading import local +from asgiref.local import Local from django.conf impo...
diff --git a/tests/async/tests.py b/tests/async/tests.py --- a/tests/async/tests.py +++ b/tests/async/tests.py @@ -4,6 +4,7 @@ from asgiref.sync import async_to_sync +from django.core.cache import DEFAULT_CACHE_ALIAS, caches from django.core.exceptions import SynchronousOnlyOperation from django.test import Simp...
Possible data loss when using caching from async code. Description CacheHandler use threading.local instead of asgiref.local.Local, hence it's a chance of data corruption if someone tries to use caching from async code. There is a potential race condition if two coroutines touch the same cache object at exactly the s...
null
2020-02-07T02:03:56Z
3.1
["test_caches_local (async.tests.CacheTest)"]
["test_async_unsafe (async.tests.AsyncUnsafeTest)", "test_async_unsafe_suppressed (async.tests.AsyncUnsafeTest)", "test_get_async_connection (async.tests.DatabaseConnectionTest)"]
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12441
da4923ea87124102aae4455e947ce24599c0365b
diff --git a/django/forms/forms.py b/django/forms/forms.py --- a/django/forms/forms.py +++ b/django/forms/forms.py @@ -191,7 +191,8 @@ def add_initial_prefix(self, field_name): def _html_output(self, normal_row, error_row, row_ender, help_text_html, errors_on_separate_row): "Output HTML. Used by as_tabl...
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -1245,6 +1245,22 @@ def clean(self): self.assertTrue(f.has_error(NON_FIELD_ERRORS, 'password_mismatch')) self.assertFals...
Calling a form method _html_output modifies the self._errors dict for NON_FIELD_ERRORS if there are hidden field with errors Description Each time the _html_output method of a form is called, it appends the errors of the hidden field errors to the NON_FIELD_ERRORS (all) entry. This happen for example when the form me...
I didn't reproduce but the report and the suggested patch make sense, accepting on that basis. Are you interested in submitting a Github pull request incorporating your patch and a regression test?
2020-02-10T21:49:56Z
3.1
["test_html_output_with_hidden_input_field_errors (forms_tests.tests.test_forms.FormsTestCase)"]
["#21962 - adding html escape flag to ErrorDict", "#5749 - `field_name` may be used as a key in _html_output().", "BoundField without any choices (subwidgets) evaluates to True.", "test_accessing_clean (forms_tests.tests.test_forms.FormsTestCase)", "test_attribute_class (forms_tests.tests.test_forms.RendererTests)", "t...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12453
b330b918e979ea39a21d47b61172d112caf432c3
diff --git a/django/db/backends/base/creation.py b/django/db/backends/base/creation.py --- a/django/db/backends/base/creation.py +++ b/django/db/backends/base/creation.py @@ -6,6 +6,7 @@ from django.conf import settings from django.core import serializers from django.db import router +from django.db.transaction impo...
diff --git a/tests/backends/base/test_creation.py b/tests/backends/base/test_creation.py --- a/tests/backends/base/test_creation.py +++ b/tests/backends/base/test_creation.py @@ -7,6 +7,8 @@ ) from django.test import SimpleTestCase +from ..models import Object, ObjectReference + def get_connection_copy(): #...
`TransactionTestCase.serialized_rollback` fails to restore objects due to ordering constraints Description I hit this problem in a fairly complex projet and haven't had the time to write a minimal reproduction case. I think it can be understood just by inspecting the code so I'm going to describe it while I have it i...
I've run into a problem related to this one (just reported as #31051), so I ended up looking into this problem as well. The original report still seems accurate to me, with the proposed solution valid. I've been working on a fix and (most of the work), testcase for this problem. I'll do some more testing and provide a ...
2020-02-13T20:03:27Z
3.1
["test_circular_reference (backends.base.test_creation.TestDeserializeDbFromString)"]
["test_custom_test_name (backends.base.test_creation.TestDbSignatureTests)", "test_custom_test_name_with_test_prefix (backends.base.test_creation.TestDbSignatureTests)", "test_default_name (backends.base.test_creation.TestDbSignatureTests)", "test_migrate_test_setting_false (backends.base.test_creation.TestDbCreationTe...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12470
142ab6846ac09d6d401e26fc8b6b988a583ac0f5
diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py --- a/django/db/models/sql/compiler.py +++ b/django/db/models/sql/compiler.py @@ -709,9 +709,9 @@ def find_ordering_name(self, name, opts, alias=None, default_order='ASC', field, targets, alias, joins, path, opts, transform_functi...
diff --git a/tests/model_inheritance/models.py b/tests/model_inheritance/models.py --- a/tests/model_inheritance/models.py +++ b/tests/model_inheritance/models.py @@ -181,6 +181,8 @@ class GrandParent(models.Model): place = models.ForeignKey(Place, models.CASCADE, null=True, related_name='+') class Meta: + ...
Inherited model doesn't correctly order by "-pk" when specified on Parent.Meta.ordering Description Given the following model definition: from django.db import models class Parent(models.Model): class Meta: ordering = ["-pk"] class Child(Parent): pass Querying the Child class results in the following: >>> print(C...
null
2020-02-19T04:48:55Z
3.1
["test_inherited_ordering_pk_desc (model_inheritance.tests.ModelInheritanceTests)"]
["Creating a child with non-abstract parents only issues INSERTs.", "test_abstract (model_inheritance.tests.ModelInheritanceTests)", "test_abstract_fk_related_name (model_inheritance.tests.InheritanceSameModelNameTests)", "test_abstract_parent_link (model_inheritance.tests.ModelInheritanceTests)", "test_custompk_m2m (m...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12477
41ebe60728a15aa273f4d70de92f5246a89c3d4e
diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py --- a/django/db/models/fields/related.py +++ b/django/db/models/fields/related.py @@ -528,6 +528,10 @@ def _check_unique_target(self): frozenset(ut) for ut in self.remote_field.model._meta.unique_together ...
diff --git a/tests/invalid_models_tests/test_relative_fields.py b/tests/invalid_models_tests/test_relative_fields.py --- a/tests/invalid_models_tests/test_relative_fields.py +++ b/tests/invalid_models_tests/test_relative_fields.py @@ -352,7 +352,11 @@ class Model(models.Model): field = Model._meta.get_field('f...
fields.E310-E311 should take into account UniqueConstraints without conditions. Description Hello, I'm trying to create migration with this kind of model. class AppUsers(models.Model): name = models.CharField(...) uid = models.CharField(...) source = models.ForeignKey(...) class Meta: constraints = [models.Uni...
Agreed, both checks should take into UniqueConstraint's without condition's. Posting a patch soon
2020-02-19T22:26:20Z
3.1
["test_foreign_key_to_non_unique_field (invalid_models_tests.test_relative_fields.RelativeFieldTests)", "test_foreign_key_to_non_unique_field_under_explicit_model (invalid_models_tests.test_relative_fields.RelativeFieldTests)", "test_foreign_key_to_partially_unique_field (invalid_models_tests.test_relative_fields.Relat...
["Ref #22047.", "test_accessor_clash (invalid_models_tests.test_relative_fields.SelfReferentialFKClashTests)", "test_accessor_clash (invalid_models_tests.test_relative_fields.SelfReferentialM2MClashTests)", "test_ambiguous_relationship_model (invalid_models_tests.test_relative_fields.RelativeFieldTests)", "test_clash_b...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12519
d4fff711d4c97356bd6ba1273d2a5e349326eb5f
diff --git a/django/db/backends/mysql/base.py b/django/db/backends/mysql/base.py --- a/django/db/backends/mysql/base.py +++ b/django/db/backends/mysql/base.py @@ -364,3 +364,10 @@ def mysql_version(self): @cached_property def mysql_is_mariadb(self): return 'mariadb' in self.mysql_server_info.lower() ...
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -1,6 +1,7 @@ import datetime import re from decimal import Decimal +from unittest import skipIf from django.core.exceptions import FieldError from django.db import connection ...
Subquery annotations are omitted in group by query section if multiple annotation are declared Description (last modified by Johannes Maron) Sadly there is more regression in Django 3.0.2 even after #31094. Background: It's the same query as #31094. I tried upgrading to Django 3.0.2 and now I get duplicate resu...
Johannes, I need to repeat my gentle request for a queryset (see comment:2 and comment:6 ) Can you provide a queryset? It's really hard to restore the original queryset from a raw SQL. I really try but without a queryset I was not able to reproduce this issue. @felixxm, it seems that Subquery annotation are omitted fro...
2020-03-02T12:53:06Z
3.1
["test_aggregation_subquery_annotation_multivalued (aggregation.tests.AggregateTestCase)"]
["Subquery annotations are excluded from the GROUP BY if they are", "test_add_implementation (aggregation.tests.AggregateTestCase)", "test_aggregate_alias (aggregation.tests.AggregateTestCase)", "test_aggregate_annotation (aggregation.tests.AggregateTestCase)", "test_aggregate_in_order_by (aggregation.tests.AggregateTe...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12556
5cc2c63f902412cdd9a8ebbabbd953aa8e2180c0
diff --git a/django/contrib/auth/hashers.py b/django/contrib/auth/hashers.py --- a/django/contrib/auth/hashers.py +++ b/django/contrib/auth/hashers.py @@ -185,7 +185,8 @@ def _load_library(self): def salt(self): """Generate a cryptographically secure nonce salt in ASCII.""" - return get_random_st...
diff --git a/tests/utils_tests/test_crypto.py b/tests/utils_tests/test_crypto.py --- a/tests/utils_tests/test_crypto.py +++ b/tests/utils_tests/test_crypto.py @@ -1,10 +1,12 @@ import hashlib import unittest -from django.test import SimpleTestCase +from django.test import SimpleTestCase, ignore_warnings from djang...
Deprecate using get_random_string without an explicit length Description django.utils.crypto.get_random_string currently has a default length value (12). I think we should force callers to specify the length value and not count on a default.
null
2020-03-11T08:49:53Z
3.1
["test_get_random_string_warning (utils_tests.test_crypto.DeprecationTests)"]
["test_constant_time_compare (utils_tests.test_crypto.TestUtilsCryptoMisc)", "test_default_hmac_alg (utils_tests.test_crypto.TestUtilsCryptoPBKDF2)", "test_get_random_string (utils_tests.test_crypto.DeprecationTests)", "test_invalid_algorithm (utils_tests.test_crypto.TestUtilsCryptoMisc)", "test_public_vectors (utils_t...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12663
fa5e7e46d875d4143510944f19d79df7b1739bab
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 @@ -233,7 +233,8 @@ def __init__(self, model, where=WhereNode, alias_cols=True): @property def output_field(self): if len(self.select) == 1: - ...
diff --git a/tests/expressions/models.py b/tests/expressions/models.py --- a/tests/expressions/models.py +++ b/tests/expressions/models.py @@ -6,10 +6,15 @@ from django.db import models +class Manager(models.Model): + name = models.CharField(max_length=50) + + class Employee(models.Model): firstname = mod...
Using SimpleLazyObject with a nested subquery annotation fails. Description (last modified by Jordan Ephron) Prior to 35431298226165986ad07e91f9d3aca721ff38ec it was possible to use a SimpleLazyObject in a queryset as demonstrated below. This new behavior appears to be a regression. Models from django.contrib.a...
I agree that this behavior was changed in 35431298226165986ad07e91f9d3aca721ff38ec, but you can easily create a test with SimpleLazyObject() (which is not a public API) and Subquery() that always fails with TypeError, e.g. def test_subquery_filter_by_lazy(self): test_user = SimpleLazyObject(lambda: get_user_model().obj...
2020-04-04T18:58:49Z
3.1
["test_subquery_filter_by_lazy (expressions.tests.BasicExpressionsTests)"]
["test_F_reuse (expressions.tests.ExpressionsTests)", "test_aggregate_subquery_annotation (expressions.tests.BasicExpressionsTests)", "test_aggregates (expressions.tests.ReprTests)", "test_and (expressions.tests.CombinableTests)", "test_annotate_values_aggregate (expressions.tests.BasicExpressionsTests)", "test_annotat...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12713
5b884d45ac5b76234eca614d90c83b347294c332
diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py --- a/django/contrib/admin/options.py +++ b/django/contrib/admin/options.py @@ -249,17 +249,25 @@ def formfield_for_manytomany(self, db_field, request, **kwargs): return None db = kwargs.get('using') - autocomp...
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -14,7 +14,9 @@ from django.contrib.auth.models import User from django.core.files.storage import default_storage from django.core.files.uploadedfile import SimpleUploadedF...
Allow overridding widget in formfield_for_manytomany(). Description (last modified by Mariusz Felisiak) It does not work when I set widget param to function formfield_for_manytomany(). This is different from the formfield_for_foreignkey() function.
null
2020-04-13T23:57:12Z
3.1
["test_formfield_overrides_m2m_filter_widget (admin_widgets.tests.AdminFormfieldForDBFieldTests)"]
["m2m fields help text as it applies to admin app (#9321).", "test_CharField (admin_widgets.tests.AdminFormfieldForDBFieldTests)", "test_DateField (admin_widgets.tests.AdminFormfieldForDBFieldTests)", "test_DateTimeField (admin_widgets.tests.AdminFormfieldForDBFieldTests)", "test_EmailField (admin_widgets.tests.AdminFo...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12771
0f2885e3f6e0c73c9f455dcbc0326ac11ba4b84c
diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py --- a/django/db/migrations/autodetector.py +++ b/django/db/migrations/autodetector.py @@ -93,7 +93,7 @@ def only_relation_agnostic_fields(self, fields): of course, the related fields change during renames). """ ...
diff --git a/tests/migrations/test_executor.py b/tests/migrations/test_executor.py --- a/tests/migrations/test_executor.py +++ b/tests/migrations/test_executor.py @@ -516,13 +516,13 @@ def test_unrelated_applied_migrations_mutate_state(self): state = executor.migrate([ ('mutate_state_a', '0001_ini...
Store ModeState.fields into a dict. Description ModeState initially stored its fields into a List[Tuple[str, models.Field]] because ​it wanted to preserve ordering. However the auto-detector doesn't consider field re-ordering as a state change and Django doesn't support table column reordering in the first place. The...
​PR
2020-04-22T03:21:43Z
3.1
["test_add_field (migrations.test_operations.OperationTests)", "test_add_field_preserve_default (migrations.test_operations.OperationTests)", "test_alter_field (migrations.test_operations.OperationTests)", "test_alter_field_pk (migrations.test_operations.OperationTests)", "test_alter_field_pk_fk (migrations.test_operat...
["A field may be migrated from AutoField to BigAutoField.", "A field may be migrated from SmallAutoField to AutoField.", "A field may be migrated from SmallAutoField to BigAutoField.", "Files prefixed with underscore, tilde, or dot aren't loaded.", "Migration directories without an __init__.py file are loaded.", "Migra...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12774
67f9d076cfc1858b94f9ed6d1a5ce2327dcc8d0d
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 @@ -689,7 +689,17 @@ def in_bulk(self, id_list=None, *, field_name='pk'): """ assert not self.query.is_sliced, \ "Cannot use 'limit' or 'offset' with in_bulk"...
diff --git a/tests/lookup/models.py b/tests/lookup/models.py --- a/tests/lookup/models.py +++ b/tests/lookup/models.py @@ -67,6 +67,11 @@ class Season(models.Model): gt = models.IntegerField(null=True, blank=True) nulled_text_field = NulledTextField(null=True) + class Meta: + constraints = [ + ...
Allow QuerySet.in_bulk() for fields with total UniqueConstraints. Description If a field is unique by UniqueConstraint instead of unique=True running in_bulk() on that field will fail. Consider: class Article(models.Model): slug = models.CharField(max_length=255) class Meta: constraints = [ models.UniqueCons...
null
2020-04-22T11:02:30Z
3.1
["test_in_bulk_meta_constraint (lookup.tests.LookupTests)"]
["Lookup.can_use_none_as_rhs=True allows None as a lookup value.", "Transforms are used for __exact=None.", "test_chain_date_time_lookups (lookup.tests.LookupTests)", "test_count (lookup.tests.LookupTests)", "test_custom_field_none_rhs (lookup.tests.LookupTests)", "test_error_messages (lookup.tests.LookupTests)", "test...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12803
35f89d199c94ebc72b06d5c44077401aa2eae47f
diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py --- a/django/contrib/staticfiles/storage.py +++ b/django/contrib/staticfiles/storage.py @@ -98,8 +98,7 @@ def hashed_name(self, name, content=None, filename=None): content.close() path, filename = os.pat...
diff --git a/tests/staticfiles_tests/storage.py b/tests/staticfiles_tests/storage.py --- a/tests/staticfiles_tests/storage.py +++ b/tests/staticfiles_tests/storage.py @@ -88,3 +88,8 @@ class ExtraPatternsStorage(ManifestStaticFilesStorage): ), ), ) + + +class NoneHashStorage(ManifestStaticFil...
ManifestFilesMixin.file_hash() returning None get's included in hashed filename as 'None'. Description (last modified by Mariusz Felisiak) When returning a string from a custom ManifestFilesMixin.file_hash() implementation, the resulting file name is <file_path>.<custom_hash>.<ext> as expected, whereas returnin...
null
2020-04-26T20:22:37Z
3.1
["test_hashed_name (staticfiles_tests.test_storage.TestCollectionNoneHashStorage)"]
["See #18050", "test_clear_empties_manifest (staticfiles_tests.test_storage.TestCollectionManifestStorage)", "test_collect_static_files_default_permissions (staticfiles_tests.test_storage.TestStaticFilePermissions)", "test_collect_static_files_permissions (staticfiles_tests.test_storage.TestStaticFilePermissions)", "te...
0668164b4ac93a5be79f5b87fae83c657124d9ab
django/django
django__django-12856
8328811f048fed0dd22573224def8c65410c9f2e
diff --git a/django/db/models/base.py b/django/db/models/base.py --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -1926,6 +1926,12 @@ def _check_constraints(cls, databases): id='models.W038', ) ) + fields = ( + fiel...
diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py --- a/tests/invalid_models_tests/test_models.py +++ b/tests/invalid_models_tests/test_models.py @@ -1501,3 +1501,70 @@ class Meta: ] self.assertEqual(Model.check(databases=self.databases), []) ...
Add check for fields of UniqueConstraints. Description (last modified by Marnanel Thurman) When a model gains a UniqueConstraint, makemigrations doesn't check that the fields named therein actually exist. This is in contrast to the older unique_together syntax, which raises models.E012 if the fields don't exist...
Demonstration Agreed. We can simply call cls._check_local_fields() for UniqueConstraint's fields. I attached tests. Tests. Hello Django Team, My name is Jannah Mandwee, and I am working on my final project for my undergraduate software engineering class (here is the link to the assignment: ​https://web.eecs.umich.edu/~...
2020-05-04T21:29:23Z
3.2
["test_unique_constraint_pointing_to_m2m_field (invalid_models_tests.test_models.ConstraintsTests)", "test_unique_constraint_pointing_to_missing_field (invalid_models_tests.test_models.ConstraintsTests)", "test_unique_constraint_pointing_to_non_local_field (invalid_models_tests.test_models.ConstraintsTests)"]
["test_check_constraints (invalid_models_tests.test_models.ConstraintsTests)", "test_check_constraints_required_db_features (invalid_models_tests.test_models.ConstraintsTests)", "test_check_jsonfield (invalid_models_tests.test_models.JSONFieldTests)", "test_check_jsonfield_required_db_features (invalid_models_tests.tes...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
django/django
django__django-12906
42c08ee46539ef44f8658ebb1cbefb408e0d03fe
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 @@ -59,6 +59,7 @@ def check_dependencies(**kwargs): """ Check that the admin's dependencies are correctly installed. """ + from django.contrib.admin.si...
diff --git a/tests/admin_checks/tests.py b/tests/admin_checks/tests.py --- a/tests/admin_checks/tests.py +++ b/tests/admin_checks/tests.py @@ -134,6 +134,12 @@ def test_context_processor_dependencies(self): "be enabled in DjangoTemplates (TEMPLATES) in order to use " "the admin applica...
Document admin's requirement on django.template.context_processors.request context processor. Description Since commit d24ba1be7a53a113d19e2860c03aff9922efec24, the admin templates use the implied request variable normally added by django.template.context_processors.request. As Django templates silence errors, this w...
​https://github.com/django/django/pull/12906 Yes, good point. Thanks Jon. Suggestion from Mariusz on the PR, to the system check an error but only if the sidebar is enabled.
2020-05-13T02:44:41Z
3.2
["test_context_processor_dependencies (admin_checks.tests.SystemChecksTestCase)"]
["\"", "'View on site should' work properly with char fields", "'save as' creates a new person", "--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...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
django/django
django__django-12908
49ae7ce50a874f8a04cd910882fb9571ff3a0d7a
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 @@ -1138,6 +1138,7 @@ def distinct(self, *field_names): """ Return a new QuerySet instance that will select only distinct results. """ + self._not_support_...
diff --git a/tests/queries/test_qs_combinators.py b/tests/queries/test_qs_combinators.py --- a/tests/queries/test_qs_combinators.py +++ b/tests/queries/test_qs_combinators.py @@ -272,6 +272,7 @@ def test_unsupported_operations_on_combined_qs(self): 'annotate', 'defer', ...
Union queryset should raise on distinct(). Description (last modified by Sielc Technologies) After using .annotate() on 2 different querysets and then .union() .distinct() will not affect the queryset def setUp(self) -> None: user = self.get_or_create_admin_user() Sample.h.create(user, name="Sam1") Sampl...
distinct() is not supported but doesn't raise an error yet. As ​​per the documentation, "only LIMIT, OFFSET, COUNT(*), ORDER BY, and specifying columns (i.e. slicing, count(), order_by(), and values()/values_list()) are allowed on the resulting QuerySet.". Follow up to #27995.
2020-05-13T11:36:48Z
3.2
["test_unsupported_operations_on_combined_qs (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_unsupported_ordering_slicing_raises_db_error (queries.test_qs_combinators.QuerySetSetOperationTests)"]
["test_combining_multiple_models (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_count_difference (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_count_intersection (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_count_union (queries.test_qs_combinators.QuerySetSetOperati...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
django/django
django__django-13022
f83b44075dafa429d59e8755aa47e15577cc49f9
diff --git a/django/core/cache/backends/base.py b/django/core/cache/backends/base.py --- a/django/core/cache/backends/base.py +++ b/django/core/cache/backends/base.py @@ -287,6 +287,6 @@ def memcache_key_warnings(key): if ord(char) < 33 or ord(char) == 127: yield ( 'Cache key cont...
diff --git a/tests/cache/tests.py b/tests/cache/tests.py --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -637,8 +637,9 @@ def func(key, *args): cache.key_func = func try: - with self.assertWarnsMessage(CacheKeyWarning, expected_warning): + with self.assertWarns(CacheKe...
Memcached key validation raises InvalidCacheKey with clunky message. Description On Django 2.2.13 the code for memcache_key_warnings in django/core/cache/backends/base.py has a bad format string that results in raising an exception rather than just producing a warning. This can be reproduced with a memcached key with...
Thanks for the report, we've already noticed this, see ​PR. It raises InvalidCacheKey for me (even if a message is not perfect), e.g. File "django/core/cache/backends/memcached.py", line 157, in validate_key raise InvalidCacheKey(warning) django.core.cache.backends.base.InvalidCacheKey: ("Cache key contains characters ...
2020-06-04T19:49:04Z
3.2
["test_invalid_key_characters (cache.tests.DBCacheTests)", "test_invalid_key_characters (cache.tests.DBCacheWithTimeZoneTests)", "test_invalid_key_characters (cache.tests.FileBasedCachePathLibTests)", "test_invalid_key_characters (cache.tests.FileBasedCacheTests)", "test_invalid_key_characters (cache.tests.LocMemCacheT...
["#20613/#18541 -- Ensures pickling is done outside of the lock.", "Add doesn't do anything in dummy cache backend", "All data types are ignored equally by the dummy cache", "Cache deletion is transparently ignored on the dummy cache backend", "Caches that have the TIMEOUT parameter undefined in the default", "Dummy ca...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
django/django
django__django-13030
36db4dd937ae11c5b687c5d2e5fa3c27e4140001
diff --git a/django/db/models/lookups.py b/django/db/models/lookups.py --- a/django/db/models/lookups.py +++ b/django/db/models/lookups.py @@ -366,10 +366,12 @@ def process_rhs(self, compiler, connection): ) if self.rhs_is_direct_value(): + # Remove None from the list as NULL is never...
diff --git a/tests/lookup/tests.py b/tests/lookup/tests.py --- a/tests/lookup/tests.py +++ b/tests/lookup/tests.py @@ -576,8 +576,6 @@ def test_none(self): self.assertQuerysetEqual(Article.objects.none().iterator(), []) def test_in(self): - # using __in with an empty list should return an empty q...
Avoid passing NULL to the IN lookup Description Currently prefetch_related on a FK passes the NULL through to the database for e.g. author_id IN (NULL, 2). Passing NULL is always unnecessary, since it's not allowed in FK's. There's a small risk from passing NULL that it could lead to incorrect with complex prefetch q...
Maybe this could generally be extended to use of __in with non-nullable fields? Since IN translates to OR = for each elements and NULL != NULL I assume it could be done at the __in lookup level even for non-nullable fields.
2020-06-05T22:49:57Z
3.2
["test_in_ignore_none (lookup.tests.LookupTests)", "test_in_ignore_none_with_unhashable_items (lookup.tests.LookupTests)", "test_in_ignore_solo_none (lookup.tests.LookupTests)"]
["Lookup.can_use_none_as_rhs=True allows None as a lookup value.", "Transforms are used for __exact=None.", "test_chain_date_time_lookups (lookup.tests.LookupTests)", "test_count (lookup.tests.LookupTests)", "test_custom_field_none_rhs (lookup.tests.LookupTests)", "test_error_messages (lookup.tests.LookupTests)", "test...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
django/django
django__django-13118
b7b7df5fbcf44e6598396905136cab5a19e9faff
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 @@ -1324,9 +1324,7 @@ def build_filter(self, filter_expr, branch_negated=False, current_negated=False, require_outer = lookup_type == 'isnull' and condition.rhs is ...
diff --git a/tests/queries/models.py b/tests/queries/models.py --- a/tests/queries/models.py +++ b/tests/queries/models.py @@ -142,6 +142,7 @@ def __str__(self): class Number(models.Model): num = models.IntegerField() other_num = models.IntegerField(null=True) + another_num = models.IntegerField(null=True...
SQL generated for negated F() expressions is incorrect Description Consider the following model definition. from django.db import models class Rectangle(models.Model): length = models.IntegerField(null=True) width = models.IntegerField(null=True) We make the following queries: Q1) Rectangles that are squares. Q2a) ...
Unfortunately this will be messy to fix. It is true that .exclude() should produce the complement of .filter(), and that doesn't happen here. One possible solution is to use WHERE ("testapp_rectangle"."length" = ("testapp_rectangle"."width")) IS NOT true. This should match both null and false values (the .filter() quer...
2020-06-27T21:51:56Z
3.2
["test_exclude_nullable_fields (queries.tests.ExcludeTests)"]
["#13227 -- If a queryset is already evaluated, it can still be used as a query arg", "Delete queries can safely contain sliced subqueries", "Subselects honor any manual ordering", "hint: inverting your ordering might do what you need", "test_21001 (queries.tests.EmptyStringsAsNullTest)", "test_AB_ACB (queries.tests.Un...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
django/django
django__django-13162
80f92177eb2a175579f4a6907ef5a358863bddca
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 @@ -295,10 +295,17 @@ def all_items_equal(seq): subclass = type("Migration",...
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 @@ -1208,12 +1208,27 @@ def test_makemigrations_interactive_accept(self): self.assertTrue(os.path.exists(merge_file)) self.asse...
Improve default name of merge migrations. Description Currently, merge migrations filenames are created with a timestamp. For example: 0003_merge_20160102_0304.py This name is more opaque than necessary. When one reads it, it isn't immediately clear which migrations were merged. One must inspect the file to find that...
null
2020-07-07T22:13:05Z
3.2
["test_makemigrations_default_merge_name (migrations.test_commands.MakeMigrationsTests)"]
["--squashed-name also works if a start migration is omitted.", "--squashed-name specifies the new migration's name.", "Migration directories without an __init__.py file are allowed.", "Tests migrate --plan output.", "test_ambiguous_prefix (migrations.test_commands.MigrateTests)", "test_app_without_migrations (migratio...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
django/django
django__django-13230
184a6eebb0ef56d5f1b1315a8e666830e37f3f81
diff --git a/django/contrib/syndication/views.py b/django/contrib/syndication/views.py --- a/django/contrib/syndication/views.py +++ b/django/contrib/syndication/views.py @@ -212,6 +212,7 @@ def get_feed(self, obj, request): author_name=author_name, author_email=author_email, ...
diff --git a/tests/syndication_tests/feeds.py b/tests/syndication_tests/feeds.py --- a/tests/syndication_tests/feeds.py +++ b/tests/syndication_tests/feeds.py @@ -29,6 +29,9 @@ def item_pubdate(self, item): def item_updateddate(self, item): return item.updated + def item_comments(self, item): + ...
Add support for item_comments to syndication framework Description Add comments argument to feed.add_item() in syndication.views so that item_comments can be defined directly without having to take the detour via item_extra_kwargs . Additionally, comments is already explicitly mentioned in the feedparser, but not imp...
null
2020-07-23T14:59:50Z
3.2
["test_rss2_feed (syndication_tests.tests.SyndicationFeedTest)"]
["test_add_domain (syndication_tests.tests.SyndicationFeedTest)", "test_atom_feed (syndication_tests.tests.SyndicationFeedTest)", "test_atom_feed_published_and_updated_elements (syndication_tests.tests.SyndicationFeedTest)", "test_atom_multiple_enclosures (syndication_tests.tests.SyndicationFeedTest)", "test_atom_singl...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d