repo
stringclasses
2 values
instance_id
stringlengths
20
22
base_commit
stringlengths
40
40
patch
stringlengths
470
13.9k
test_patch
stringlengths
545
19.2k
problem_statement
stringlengths
162
9.25k
hints_text
stringlengths
0
14.2k
created_at
stringdate
2018-02-07 15:05:31
2023-06-27 19:48:18
version
stringclasses
8 values
FAIL_TO_PASS
stringlengths
55
32.6k
PASS_TO_PASS
stringlengths
2
107k
environment_setup_commit
stringclasses
9 values
difficulty
stringclasses
3 values
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 y...
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_coord_matrix", "astropy/modeling/tests/test_separable.py::test_cdot", "astropy/modeling/tests/test_separable.py::test_cstack", "astropy/modeling/tests/test_separable.py::test_arith_oper", "astropy/modeling/tests/test_separable.py::test_separable[compound_model0-result0]"...
298ccb478e6bf092953bca67a3d29dc6c35f6752
15 min - 1 hour
astropy/astropy
astropy__astropy-13033
298ccb478e6bf092953bca67a3d29dc6c35f6752
diff --git a/astropy/timeseries/core.py b/astropy/timeseries/core.py --- a/astropy/timeseries/core.py +++ b/astropy/timeseries/core.py @@ -55,6 +55,13 @@ class BaseTimeSeries(QTable): _required_columns_relax = False def _check_required_columns(self): + def as_scalar_or_list_str(obj): + if ...
diff --git a/astropy/timeseries/tests/test_sampled.py b/astropy/timeseries/tests/test_sampled.py --- a/astropy/timeseries/tests/test_sampled.py +++ b/astropy/timeseries/tests/test_sampled.py @@ -395,6 +395,14 @@ def test_required_columns(): assert exc.value.args[0] == ("TimeSeries object is invalid - expected " ...
TimeSeries: misleading exception when required column check fails. <!-- 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...
The relevant code that produces the misleading exception. https://github.com/astropy/astropy/blob/00ccfe76113dca48d19396986872203dc2e978d7/astropy/timeseries/core.py#L77-L82 It works under the assumption that `time` is the only required column. So when a `TimeSeries` object has additional required columns, the me...
2022-03-31T23:28:27Z
4.3
["astropy/timeseries/tests/test_sampled.py::test_required_columns"]
["astropy/timeseries/tests/test_sampled.py::test_empty_initialization", "astropy/timeseries/tests/test_sampled.py::test_empty_initialization_invalid", "astropy/timeseries/tests/test_sampled.py::test_initialize_only_time", "astropy/timeseries/tests/test_sampled.py::test_initialization_with_data", "astropy/timeseries/tes...
298ccb478e6bf092953bca67a3d29dc6c35f6752
15 min - 1 hour
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 che...
@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.0
["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_attributes[arrayswap]", "astropy/table/tests/test_mixin.py::test_attributes[arraywrap]", "astropy/table/tests/test_mixin.py::test_attributes[cartesianrep]", "astropy/table/tests/test_mixin.py::test_attributes[earthlocation]", "astropy/table/tests/test_mixin.py::test_attributes[...
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
15 min - 1 hour
astropy/astropy
astropy__astropy-13398
6500928dc0e57be8f06d1162eacc3ba5e2eff692
diff --git a/astropy/coordinates/builtin_frames/__init__.py b/astropy/coordinates/builtin_frames/__init__.py --- a/astropy/coordinates/builtin_frames/__init__.py +++ b/astropy/coordinates/builtin_frames/__init__.py @@ -48,6 +48,7 @@ from . import icrs_cirs_transforms from . import cirs_observed_transforms from . imp...
diff --git a/astropy/coordinates/tests/test_intermediate_transformations.py b/astropy/coordinates/tests/test_intermediate_transformations.py --- a/astropy/coordinates/tests/test_intermediate_transformations.py +++ b/astropy/coordinates/tests/test_intermediate_transformations.py @@ -194,6 +194,116 @@ def test_cirs_to_ha...
A direct approach to ITRS to Observed transformations that stays within the ITRS. <!-- This comments are hidden when you submit the issue, so you do not need to remove them! --> <!-- Please be sure to check out our contributing guidelines, https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md . Please be s...
cc @StuartLittlefair, @adrn, @eteq, @eerovaher, @mhvk Yes, would be good to address this recurring problem. But we somehow have to ensure it gets used only when relevant. For instance, the coordinates better have a distance, and I suspect it has to be near Earth... Yeah, so far I've made no attempt at hardening this a...
2022-06-24T15:22:11Z
5.0
["astropy/coordinates/tests/test_intermediate_transformations.py::test_itrs_topo_to_altaz_with_refraction", "astropy/coordinates/tests/test_intermediate_transformations.py::test_itrs_topo_to_hadec_with_refraction", "astropy/coordinates/tests/test_intermediate_transformations.py::test_cirs_itrs_topo", "astropy/coordinat...
["astropy/coordinates/tests/test_intermediate_transformations.py::test_icrs_gcrs[icoo0]", "astropy/coordinates/tests/test_intermediate_transformations.py::test_icrs_gcrs[icoo1]", "astropy/coordinates/tests/test_intermediate_transformations.py::test_icrs_gcrs_dist_diff[gframe0]", "astropy/coordinates/tests/test_intermed...
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
1-4 hours
astropy/astropy
astropy__astropy-13453
19cc80471739bcb67b7e8099246b391c355023ee
diff --git a/astropy/io/ascii/html.py b/astropy/io/ascii/html.py --- a/astropy/io/ascii/html.py +++ b/astropy/io/ascii/html.py @@ -349,11 +349,13 @@ def write(self, table): cols = list(table.columns.values()) self.data.header.cols = cols + self.data.cols = cols if isinstance(self.d...
diff --git a/astropy/io/ascii/tests/test_html.py b/astropy/io/ascii/tests/test_html.py --- a/astropy/io/ascii/tests/test_html.py +++ b/astropy/io/ascii/tests/test_html.py @@ -717,6 +717,49 @@ def test_multi_column_write_table_html_fill_values_masked(): assert buffer_output.getvalue() == buffer_expected.getvalue() ...
ASCII table output to HTML does not support supplied "formats" <!-- 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 ou...
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-14T10:04:40Z
5.0
["astropy/io/ascii/tests/test_html.py::test_write_table_formatted_columns"]
["astropy/io/ascii/tests/test_html.py::test_listwriter", "astropy/io/ascii/tests/test_html.py::test_htmlinputter_no_bs4", "astropy/io/ascii/tests/test_html.py::test_multicolumn_write", "astropy/io/ascii/tests/test_html.py::test_write_no_multicols", "astropy/io/ascii/tests/test_html.py::test_write_table_html_fill_values...
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
15 min - 1 hour
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...
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 ...
2022-08-26T15:06:53Z
5.0
["astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py::test_coupled_world_slicing"]
["astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py::test_invalid_slices", "astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py::test_sanitize_slice[item0-4-expected0]", "astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs.py::test_sanitize_slice[item1-5-expected1]", "astropy/wcs/wcsapi/wrappers/tests/test_sliced_wcs...
cdf311e0714e611d48b0a31eb1f0e2cbffab7f23
1-4 hours
astropy/astropy
astropy__astropy-13977
5250b2442501e6c671c6b380536f1edb352602d1
diff --git a/astropy/units/quantity.py b/astropy/units/quantity.py --- a/astropy/units/quantity.py +++ b/astropy/units/quantity.py @@ -633,53 +633,70 @@ def __array_ufunc__(self, function, method, *inputs, **kwargs): Returns ------- - result : `~astropy.units.Quantity` + result : `~ast...
diff --git a/astropy/units/tests/test_quantity.py b/astropy/units/tests/test_quantity.py --- a/astropy/units/tests/test_quantity.py +++ b/astropy/units/tests/test_quantity.py @@ -505,11 +505,10 @@ def test_incompatible_units(self): def test_non_number_type(self): q1 = u.Quantity(11.412, unit=u.meter) - ...
Should `Quantity.__array_ufunc__()` return `NotImplemented` instead of raising `ValueError` if the inputs are incompatible? ### Description I'm trying to implement a duck type of `astropy.units.Quantity`. If you are interested, the project is available [here](https://github.com/Kankelborg-Group/named_arrays). I'm runn...
@byrdie - I think you are right that really one should return `NotImplemented`. In general, the idea is indeed that one only works on classes that are recognized, while in the implementation that we have (which I wrote...) essentially everything that has a `unit` attribute is treated as a `Quantity`. I think it is a go...
2022-11-01T22:24:58Z
5.1
["astropy/units/tests/test_quantity_ufuncs.py::TestUfuncReturnsNotImplemented::TestBinaryUfuncs::test_full[None-duck_quantity0-quantity0-add]", "astropy/units/tests/test_quantity_ufuncs.py::TestUfuncReturnsNotImplemented::TestBinaryUfuncs::test_full[None-duck_quantity0-quantity0-less]", "astropy/units/tests/test_quanti...
["astropy/units/tests/test_quantity.py::TestQuantityCreation::test_1", "astropy/units/tests/test_quantity.py::TestQuantityCreation::test_2", "astropy/units/tests/test_quantity.py::TestQuantityCreation::test_3", "astropy/units/tests/test_quantity.py::TestQuantityCreation::test_nan_inf", "astropy/units/tests/test_quantit...
5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5
15 min - 1 hour
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_is_transformable_to_str_input", "astropy/coordinates/tests/test_sky_coord.py::test_transform_to", "astropy/coordinates/tests/test_sky_coord.py::test_round_tripping[ICRS-ICRS-None-None-None-None]", "astropy/coordinates/tests/test_sky_coord.py::test_round_tripping[ICRS-...
5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5
15 min - 1 hour
astropy/astropy
astropy__astropy-14182
a5917978be39d13cd90b517e1de4e7a539ffaa48
diff --git a/astropy/io/ascii/rst.py b/astropy/io/ascii/rst.py --- a/astropy/io/ascii/rst.py +++ b/astropy/io/ascii/rst.py @@ -27,7 +27,6 @@ def get_fixedwidth_params(self, line): class SimpleRSTData(FixedWidthData): - start_line = 3 end_line = -1 splitter_class = FixedWidthTwoLineDataSplitter @@ -3...
diff --git a/astropy/io/ascii/tests/test_rst.py b/astropy/io/ascii/tests/test_rst.py --- a/astropy/io/ascii/tests/test_rst.py +++ b/astropy/io/ascii/tests/test_rst.py @@ -2,7 +2,11 @@ from io import StringIO +import numpy as np + +import astropy.units as u from astropy.io import ascii +from astropy.table import Q...
Please support header rows in RestructuredText output ### Description It would be great if the following would work: ```Python >>> from astropy.table import QTable >>> import astropy.units as u >>> import sys >>> tbl = QTable({'wave': [350,950]*u.nm, 'response': [0.7, 1.2]*u.count}) >>> tbl.write(sys.stdout,...
2022-12-16T11:13:37Z
5.1
["astropy/io/ascii/tests/test_rst.py::test_rst_with_header_rows"]
["astropy/io/ascii/tests/test_rst.py::test_read_normal", "astropy/io/ascii/tests/test_rst.py::test_read_normal_names", "astropy/io/ascii/tests/test_rst.py::test_read_normal_names_include", "astropy/io/ascii/tests/test_rst.py::test_read_normal_exclude", "astropy/io/ascii/tests/test_rst.py::test_read_unbounded_right_colu...
5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5
15 min - 1 hour
astropy/astropy
astropy__astropy-14309
cdb66059a2feb44ee49021874605ba90801f9986
diff --git a/astropy/io/fits/connect.py b/astropy/io/fits/connect.py --- a/astropy/io/fits/connect.py +++ b/astropy/io/fits/connect.py @@ -65,10 +65,9 @@ def is_fits(origin, filepath, fileobj, *args, **kwargs): fileobj.seek(pos) return sig == FITS_SIGNATURE elif filepath is not None: - if ...
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 @@ -7,7 +7,14 @@ from astropy import units as u from astropy.io import fits -from astropy.io.fits import BinTableHDU, HDUList, ImageHDU, ...
IndexError: tuple index out of range in identify_format (io.registry) <!-- 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...
cc @nstarman from #14274
2023-01-23T22:34:01Z
5.1
["astropy/io/fits/tests/test_connect.py::test_is_fits_gh_14305"]
["astropy/io/fits/tests/test_connect.py::TestSingleTable::test_simple", "astropy/io/fits/tests/test_connect.py::TestSingleTable::test_simple_pathlib", "astropy/io/fits/tests/test_connect.py::TestSingleTable::test_simple_meta", "astropy/io/fits/tests/test_connect.py::TestSingleTable::test_simple_meta_conflicting", "astr...
5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5
<15 min fix
astropy/astropy
astropy__astropy-14365
7269fa3e33e8d02485a647da91a5a2a60a06af61
diff --git a/astropy/io/ascii/qdp.py b/astropy/io/ascii/qdp.py --- a/astropy/io/ascii/qdp.py +++ b/astropy/io/ascii/qdp.py @@ -68,7 +68,7 @@ def _line_type(line, delimiter=None): _new_re = rf"NO({sep}NO)+" _data_re = rf"({_decimal_re}|NO|[-+]?nan)({sep}({_decimal_re}|NO|[-+]?nan))*)" _type_re = rf"^\s*((...
diff --git a/astropy/io/ascii/tests/test_qdp.py b/astropy/io/ascii/tests/test_qdp.py --- a/astropy/io/ascii/tests/test_qdp.py +++ b/astropy/io/ascii/tests/test_qdp.py @@ -43,7 +43,18 @@ def test_get_tables_from_qdp_file(tmp_path): assert np.isclose(table2["MJD_nerr"][0], -2.37847222222222e-05) -def test_roundt...
ascii.qdp Table format assumes QDP commands are upper case ### Description ascii.qdp assumes that commands in a QDP file are upper case, for example, for errors they must be "READ SERR 1 2" whereas QDP itself is not case sensitive and case use "read serr 1 2". As many QDP files are created by hand, the expectation...
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-02-06T19:20:34Z
5.1
["astropy/io/ascii/tests/test_qdp.py::test_roundtrip[True]"]
["astropy/io/ascii/tests/test_qdp.py::test_get_tables_from_qdp_file", "astropy/io/ascii/tests/test_qdp.py::test_roundtrip[False]", "astropy/io/ascii/tests/test_qdp.py::test_read_example", "astropy/io/ascii/tests/test_qdp.py::test_roundtrip_example", "astropy/io/ascii/tests/test_qdp.py::test_roundtrip_example_comma", "a...
5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5
15 min - 1 hour
astropy/astropy
astropy__astropy-14369
fa4e8d1cd279acf9b24560813c8652494ccd5922
diff --git a/astropy/units/format/cds.py b/astropy/units/format/cds.py --- a/astropy/units/format/cds.py +++ b/astropy/units/format/cds.py @@ -138,8 +138,7 @@ def _make_parser(cls): for Astronomical Catalogues 2.0 <http://vizier.u-strasbg.fr/vizier/doc/catstd-3.2.htx>`_, which is not terribly...
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 @@ -60,9 +60,13 @@ def test_unit_grammar_fail(string): (["mW/m2"], u.Unit(u.erg / u.cm**2 / u.s)), (["mW/(m2)"], u.Unit(u.erg / u.cm**2...
Incorrect units read from MRT (CDS format) files with astropy.table ### Description When reading MRT files (formatted according to the CDS standard which is also the format recommended by AAS/ApJ) with `format='ascii.cds'`, astropy.table incorrectly parses composite units. According to CDS standard the units should be...
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-02-06T21:56:51Z
5.1
["astropy/units/tests/test_format.py::test_cds_grammar[strings4-unit4]", "astropy/units/tests/test_format.py::test_cds_grammar[strings6-unit6]", "astropy/units/tests/test_format.py::test_cds_grammar_fail[km/s.Mpc-1]"]
["astropy/units/tests/test_format.py::test_unit_grammar[strings0-unit0]", "astropy/units/tests/test_format.py::test_unit_grammar[strings1-unit1]", "astropy/units/tests/test_format.py::test_unit_grammar[strings2-unit2]", "astropy/units/tests/test_format.py::test_unit_grammar[strings3-unit3]", "astropy/units/tests/test_f...
5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5
1-4 hours
astropy/astropy
astropy__astropy-14508
a3f4ae6cd24d5ecdf49f213d77b3513dd509a06c
diff --git a/astropy/io/fits/card.py b/astropy/io/fits/card.py --- a/astropy/io/fits/card.py +++ b/astropy/io/fits/card.py @@ -1298,31 +1298,17 @@ def _format_value(value): def _format_float(value): - """Format a floating number to make sure it gets the decimal point.""" - value_str = f"{value:.16G}" - if...
diff --git a/astropy/io/fits/tests/test_header.py b/astropy/io/fits/tests/test_header.py --- a/astropy/io/fits/tests/test_header.py +++ b/astropy/io/fits/tests/test_header.py @@ -137,6 +137,27 @@ def test_floating_point_value_card(self): ): assert str(c) == _pad("FLOATNUM= -4.6737463674763E+32") ...
`io.fits.Card` may use a string representation of floats that is larger than necessary ### Description In some scenarios, `io.fits.Card` may use a string representation of floats that is larger than necessary, which can force comments to be truncated. Due to this, there are some keyword/value/comment combinations that...
Agreed this is a bug. As far as I know, python floats by default now have reprs that use the right number of digits to be reproducible. So I think replacing this by `value_str = str(value)` should be totally fine. Do you want to try that and run the tests, to see if it works? If so, I think we should make that change ...
2023-03-09T11:08:51Z
5.1
["astropy/io/fits/tests/test_header.py::TestHeaderFunctions::test_floating_point_string_representation_card"]
["astropy/io/fits/tests/test_header.py::test_shallow_copy", "astropy/io/fits/tests/test_header.py::test_init_with_header", "astropy/io/fits/tests/test_header.py::test_init_with_dict", "astropy/io/fits/tests/test_header.py::test_init_with_ordereddict", "astropy/io/fits/tests/test_header.py::TestHeaderFunctions::test_ren...
5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5
15 min - 1 hour
astropy/astropy
astropy__astropy-14539
c0a24c1dc957a3b565294213f435fefb2ec99714
diff --git a/astropy/io/fits/diff.py b/astropy/io/fits/diff.py --- a/astropy/io/fits/diff.py +++ b/astropy/io/fits/diff.py @@ -1449,7 +1449,7 @@ def _diff(self): arrb.dtype, np.floating ): diffs = where_not_allclose(arra, arrb, rtol=self.rtol, atol=self.atol) - ...
diff --git a/astropy/io/fits/tests/test_diff.py b/astropy/io/fits/tests/test_diff.py --- a/astropy/io/fits/tests/test_diff.py +++ b/astropy/io/fits/tests/test_diff.py @@ -406,16 +406,17 @@ def test_identical_tables(self): c8 = Column("H", format="C", array=[0.0 + 1.0j, 2.0 + 3.0j]) c9 = Column("I", fo...
`io.fits.FITSDiff` may sometimes report differences between identical files ### Description In some scenarios, `io.fits.FITSDiff` may report differences between identical files, even when comparing the same file to itself. This may be caused by improper handling of VLAs (variable-length arrays). ### Expected behavior...
Seems due to the use of `Q`, only `P` is handled in the diff code. This: ``` --- astropy/io/fits/diff.py +++ astropy/io/fits/diff.py @@ -1449,7 +1449,7 @@ class TableDataDiff(_BaseDiff): arrb.dtype, np.floating ): diffs = where_not_allclose(arra, arrb, rtol=self.rto...
2023-03-16T18:45:19Z
5.1
["astropy/io/fits/tests/test_diff.py::TestDiff::test_identical_tables", "astropy/io/fits/tests/test_diff.py::TestDiff::test_different_table_data"]
["astropy/io/fits/tests/test_diff.py::TestDiff::test_identical_headers", "astropy/io/fits/tests/test_diff.py::TestDiff::test_slightly_different_headers", "astropy/io/fits/tests/test_diff.py::TestDiff::test_common_keywords", "astropy/io/fits/tests/test_diff.py::TestDiff::test_different_keyword_count", "astropy/io/fits/t...
5f74eacbcc7fff707a44d8eb58adaa514cb7dcb5
15 min - 1 hour
astropy/astropy
astropy__astropy-14598
80c3854a5f4f4a6ab86c03d9db7854767fcd83c1
diff --git a/astropy/io/fits/card.py b/astropy/io/fits/card.py --- a/astropy/io/fits/card.py +++ b/astropy/io/fits/card.py @@ -66,7 +66,7 @@ class Card(_Verify): # followed by an optional comment _strg = r"\'(?P<strg>([ -~]+?|\'\'|) *?)\'(?=$|/| )" _comm_field = r"(?P<comm_field>(?P<sepr>/ *)(?P<comm>(.|...
diff --git a/astropy/io/fits/tests/test_header.py b/astropy/io/fits/tests/test_header.py --- a/astropy/io/fits/tests/test_header.py +++ b/astropy/io/fits/tests/test_header.py @@ -582,6 +582,22 @@ def test_long_string_value_via_fromstring(self, capsys): "CONTINUE '' / comments in line 1 comments with '...
Inconsistency in double single-quote ('') management in FITS Card ### Description The management of single-quotes in FITS cards seem correct, except *sometimes* when dealing with null strings, i.e. double single quotes (`''`), which sometimes are transformed into single single quotes (`'`). E.g.: ```python In [...
Hello, I would like to be assigned to this issue if possible. Thank you. Hi @ashtonw3, We don't usually assign people to issues, mentioning here that you want to work on it is enough. But on this specific issue I already have a fix and will open a PR soon, I was going to do that yesterday but I found another related ...
2023-03-29T10:34:49Z
5.2
["astropy/io/fits/tests/test_header.py::TestHeaderFunctions::test_long_string_value_with_quotes"]
["astropy/io/fits/tests/test_header.py::test_shallow_copy", "astropy/io/fits/tests/test_header.py::test_init_with_header", "astropy/io/fits/tests/test_header.py::test_init_with_dict", "astropy/io/fits/tests/test_header.py::test_init_with_ordereddict", "astropy/io/fits/tests/test_header.py::TestHeaderFunctions::test_ren...
362f6df12abf9bd769d4915fabf955c993ea22cf
15 min - 1 hour
astropy/astropy
astropy__astropy-14995
b16c7d12ccbc7b2d20364b89fb44285bcbfede54
diff --git a/astropy/nddata/mixins/ndarithmetic.py b/astropy/nddata/mixins/ndarithmetic.py --- a/astropy/nddata/mixins/ndarithmetic.py +++ b/astropy/nddata/mixins/ndarithmetic.py @@ -520,10 +520,10 @@ def _arithmetic_mask(self, operation, operand, handle_mask, axis=None, **kwds): elif self.mask is None and ope...
diff --git a/astropy/nddata/mixins/tests/test_ndarithmetic.py b/astropy/nddata/mixins/tests/test_ndarithmetic.py --- a/astropy/nddata/mixins/tests/test_ndarithmetic.py +++ b/astropy/nddata/mixins/tests/test_ndarithmetic.py @@ -1310,3 +1310,42 @@ def test_raise_method_not_supported(): # raise error for unsupported ...
In v5.3, NDDataRef mask propagation fails when one of the operand does not have a mask ### Description This applies to v5.3. It looks like when one of the operand does not have a mask, the mask propagation when doing arithmetic, in particular with `handle_mask=np.bitwise_or` fails. This is not a problem in v5.2. ...
Welcome to Astropy 👋 and thank you for your first issue! A project member will respond to you as soon as possible; in the meantime, please double-check the [guidelines for submitting issues](https://github.com/astropy/astropy/blob/main/CONTRIBUTING.md#reporting-issues) and make sure you've provided the requested deta...
2023-06-27T19:48:18Z
5.2
["astropy/nddata/mixins/tests/test_ndarithmetic.py::test_nddata_bitmask_arithmetic"]
["astropy/nddata/mixins/tests/test_ndarithmetic.py::test_arithmetics_data[data10-data20]", "astropy/nddata/mixins/tests/test_ndarithmetic.py::test_arithmetics_data[data11-data21]", "astropy/nddata/mixins/tests/test_ndarithmetic.py::test_arithmetics_data[data12-data22]", "astropy/nddata/mixins/tests/test_ndarithmetic.py...
362f6df12abf9bd769d4915fabf955c993ea22cf
<15 min fix
astropy/astropy
astropy__astropy-7166
26d147868f8a891a6009a25cd6a8576d2e1bd747
diff --git a/astropy/utils/misc.py b/astropy/utils/misc.py --- a/astropy/utils/misc.py +++ b/astropy/utils/misc.py @@ -4,9 +4,6 @@ A "grab bag" of relatively small general-purpose utilities that don't have a clear module/package to live in. """ - - - import abc import contextlib import difflib @@ -27,7 +24,6 @@ ...
diff --git a/astropy/utils/tests/test_misc.py b/astropy/utils/tests/test_misc.py --- a/astropy/utils/tests/test_misc.py +++ b/astropy/utils/tests/test_misc.py @@ -80,14 +80,26 @@ def __call__(self, *args): "FOO" pass + @property + def bar(self): + "BAR" + ...
InheritDocstrings metaclass doesn't work for properties Inside the InheritDocstrings metaclass it uses `inspect.isfunction` which returns `False` for properties.
This was as implemented back in #2159. I don't see any `inspect.isproperty`. Do you have any suggestions? I guess it should work with [inspect.isdatadescriptor](https://docs.python.org/3/library/inspect.html#inspect.isdatadescriptor). And I wonder if this class is still needed, it seems that it started with #2136 for...
2018-02-07T15:05:31Z
1.3
["astropy/utils/tests/test_misc.py::test_inherit_docstrings"]
["astropy/utils/tests/test_misc.py::test_isiterable", "astropy/utils/tests/test_misc.py::test_signal_number_to_name_no_failure", "astropy/utils/tests/test_misc.py::test_skip_hidden", "astropy/utils/tests/test_misc.py::test_JsonCustomEncoder", "astropy/utils/tests/test_misc.py::test_check_broadcast", "astropy/utils/test...
848c8fa21332abd66b44efe3cb48b72377fb32cc
<15 min fix
astropy/astropy
astropy__astropy-7336
732d89c2940156bdc0e200bb36dc38b5e424bcba
diff --git a/astropy/units/decorators.py b/astropy/units/decorators.py --- a/astropy/units/decorators.py +++ b/astropy/units/decorators.py @@ -220,7 +220,7 @@ def wrapper(*func_args, **func_kwargs): # Call the original function with any equivalencies in force. with add_enabled_equivalencies(se...
diff --git a/astropy/units/tests/py3_test_quantity_annotations.py b/astropy/units/tests/test_quantity_annotations.py similarity index 60% rename from astropy/units/tests/py3_test_quantity_annotations.py rename to astropy/units/tests/test_quantity_annotations.py --- a/astropy/units/tests/py3_test_quantity_annotations.py...
units.quantity_input decorator fails for constructors with type hinted return value -> None ### Summary I am using the `units.quantity_input` decorator with typing hints for constructors, however when I add the correct return value for the constructor (`None`) then I get an exception, because `None` has no attribute `...
`git blame` says #3072 -- @Cadair ! yeah, I did add this feature...
2018-03-28T15:31:32Z
1.3
["astropy/units/tests/test_quantity_annotations.py::test_return_annotation_none"]
["astropy/units/tests/test_quantity_annotations.py::test_args3[solarx_unit0-solary_unit0]", "astropy/units/tests/test_quantity_annotations.py::test_args3[angle-angle]", "astropy/units/tests/test_quantity_annotations.py::test_args_noconvert3[solarx_unit0-solary_unit0]", "astropy/units/tests/test_quantity_annotations.py:...
848c8fa21332abd66b44efe3cb48b72377fb32cc
<15 min fix
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 la...
`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_getting_started", "astropy/units/tests/test_units.py::test_initialisation", "astropy/units/tests/test_units.py::test_invalid_power", "astropy/units/tests/test_units.py::test_invalid_compare", "astropy/units/tests/test_units.py::test_convert", "astropy/units/tests/test_units.py:...
848c8fa21332abd66b44efe3cb48b72377fb32cc
15 min - 1 hour
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 astro...
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_pkg_finder", "astropy/utils/tests/test_introspection.py::test_find_current_mod", "astropy/utils/tests/test_introspection.py::test_find_mod_objs"]
848c8fa21332abd66b44efe3cb48b72377fb32cc
15 min - 1 hour
astropy/astropy
astropy__astropy-8707
a85a0747c54bac75e9c3b2fe436b105ea029d6cf
diff --git a/astropy/io/fits/card.py b/astropy/io/fits/card.py --- a/astropy/io/fits/card.py +++ b/astropy/io/fits/card.py @@ -554,6 +554,13 @@ def fromstring(cls, image): """ card = cls() + if isinstance(image, bytes): + # FITS supports only ASCII, but decode as latin1 and just ta...
diff --git a/astropy/io/fits/tests/test_header.py b/astropy/io/fits/tests/test_header.py --- a/astropy/io/fits/tests/test_header.py +++ b/astropy/io/fits/tests/test_header.py @@ -85,6 +85,15 @@ def test_card_constructor_default_args(self): c = fits.Card() assert '' == c.keyword + def test_card_fr...
Header.fromstring does not accept Python 3 bytes According to [the docs](http://docs.astropy.org/en/stable/_modules/astropy/io/fits/header.html#Header.fromstring), the method `Header.fromstring` "...creates an HDU header from a byte string containing the entire header data." By "byte string" here it really means the...
2019-05-15T13:21:19Z
3.1
["astropy/io/fits/tests/test_header.py::TestHeaderFunctions::test_card_from_bytes"]
["astropy/io/fits/tests/test_header.py::test_shallow_copy", "astropy/io/fits/tests/test_header.py::test_init_with_header", "astropy/io/fits/tests/test_header.py::test_init_with_dict", "astropy/io/fits/tests/test_header.py::test_init_with_ordereddict", "astropy/io/fits/tests/test_header.py::TestHeaderFunctions::test_ren...
2e89d074b3b2abc2da80e437c93b1d5516a0ca57
15 min - 1 hour
astropy/astropy
astropy__astropy-8872
b750a0e6ee76fb6b8a099a4d16ec51977be46bf6
diff --git a/astropy/units/quantity.py b/astropy/units/quantity.py --- a/astropy/units/quantity.py +++ b/astropy/units/quantity.py @@ -215,8 +215,8 @@ class Quantity(np.ndarray, metaclass=InheritDocstrings): dtype : ~numpy.dtype, optional The dtype of the resulting Numpy array or scalar that will ...
diff --git a/astropy/units/tests/test_quantity.py b/astropy/units/tests/test_quantity.py --- a/astropy/units/tests/test_quantity.py +++ b/astropy/units/tests/test_quantity.py @@ -138,10 +138,13 @@ def test_preserve_dtype(self): assert q2.value == float(q1.value) assert q2.unit == q1.unit - # ...
float16 quantities get upgraded to float64 automatically When trying to create a `Quantity` from a `np.float16` (not something I actually intended to do, I was experimenting while investigating other issue) it gets upgraded automatically to `np.float64`, which is something that does not happen with other float types: ...
Hmm, it was added in gh-1776 (code in [l299](https://github.com/astropy/astropy/blob/master/astropy/units/quantity.py#L299) and [l379](https://github.com/astropy/astropy/blob/master/astropy/units/quantity.py#L379) by checking `np.can_cast(np.float32, value.dtype)`. From the discussion, it seems half floats were never c...
2019-06-19T20:34:56Z
3.1
["astropy/units/tests/test_quantity.py::TestQuantityCreation::test_preserve_dtype"]
["astropy/units/tests/test_quantity.py::TestQuantityCreation::test_1", "astropy/units/tests/test_quantity.py::TestQuantityCreation::test_2", "astropy/units/tests/test_quantity.py::TestQuantityCreation::test_3", "astropy/units/tests/test_quantity.py::TestQuantityCreation::test_nan_inf", "astropy/units/tests/test_quantit...
2e89d074b3b2abc2da80e437c93b1d5516a0ca57
15 min - 1 hour
django/django
django__django-10097
b9cf764be62e77b4777b3a75ec256f6209a57671
diff --git a/django/core/validators.py b/django/core/validators.py --- a/django/core/validators.py +++ b/django/core/validators.py @@ -94,7 +94,7 @@ class URLValidator(RegexValidator): regex = _lazy_re_compile( r'^(?:[a-z0-9\.\-\+]*)://' # scheme is validated separately - r'(?:\S+(?::\S*)?@)?' ...
diff --git a/tests/validators/invalid_urls.txt b/tests/validators/invalid_urls.txt --- a/tests/validators/invalid_urls.txt +++ b/tests/validators/invalid_urls.txt @@ -57,3 +57,9 @@ http://example.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa. http://example.aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa...
Make URLValidator reject invalid characters in the username and password Description (last modified by Tim Bell) Since #20003, core.validators.URLValidator accepts URLs with usernames and passwords. RFC 1738 section 3.1 requires "Within the user and password field, any ":", "@", or "/" must be encoded"; however...
2018-06-26T23:30:51Z
2.2
["test_ascii_validator (auth_tests.test_validators.UsernameValidatorsTests)", "test_unicode_validator (auth_tests.test_validators.UsernameValidatorsTests)", "test_help_text (auth_tests.test_validators.UserAttributeSimilarityValidatorTest)", "test_validate (auth_tests.test_validators.UserAttributeSimilarityValidatorTest...
["test_defaults (str.tests.SimpleTests)", "test_international (str.tests.SimpleTests)", "test_default (model_fields.test_decimalfield.DecimalFieldTests)", "test_filter_with_strings (model_fields.test_decimalfield.DecimalFieldTests)", "test_get_prep_value (model_fields.test_decimalfield.DecimalFieldTests)", "test_lookup...
4fc35a9c3efdc9154efce28cb23cb84f8834517e
<15 min fix
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.0
["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
1-4 hours
django/django
django__django-10880
838e432e3e5519c5383d12018e6c78f8ec7833c1
diff --git a/django/db/models/aggregates.py b/django/db/models/aggregates.py --- a/django/db/models/aggregates.py +++ b/django/db/models/aggregates.py @@ -68,7 +68,7 @@ def get_group_by_cols(self): return [] def as_sql(self, compiler, connection, **extra_context): - extra_context['distinct'] = 'D...
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -8,6 +8,7 @@ Avg, Count, DecimalField, DurationField, F, FloatField, Func, IntegerField, Max, Min, Sum, Value, ) +from django.db.models.expressions import Case, When from...
Query syntax error with condition and distinct combination Description A Count annotation containing both a Case condition and a distinct=True param produces a query error on Django 2.2 (whatever the db backend). A space is missing at least (... COUNT(DISTINCTCASE WHEN ...).
Failing test example Bisected to [bc05547cd8c1dd511c6b6a6c873a1bc63417b111] Fixed #28658 -- Added DISTINCT handling to the Aggregate class.
2019-01-21T00:22:36Z
3.0
["test_count_distinct_expression (aggregation.tests.AggregateTestCase)"]
["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.AggregateTestCase)", "test_aggregate_multi_join (aggregation.tests.AggregateTe...
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
django/django
django__django-10914
e7fd69d051eaa67cb17f172a39b57253e9cb831a
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 @@ -304,7 +304,7 @@ def gettext_noop(s): # The numeric mode to set newly-uploaded files to. The value should be a mode # you'd pass directly to os.chmod; see https:/...
diff --git a/tests/test_utils/tests.py b/tests/test_utils/tests.py --- a/tests/test_utils/tests.py +++ b/tests/test_utils/tests.py @@ -1099,7 +1099,7 @@ def test_override_file_upload_permissions(self): the file_permissions_mode attribute of django.core.files.storage.default_storage. """ - ...
Set default FILE_UPLOAD_PERMISSION to 0o644. Description Hello, As far as I can see, the ​File Uploads documentation page does not mention any permission issues. What I would like to see is a warning that in absence of explicitly configured FILE_UPLOAD_PERMISSIONS, the permissions for a file uploaded to FileSystemSto...
I think you're talking about ef70af77ec53160d5ffa060c1bdf5ed93322d84f (#28540). I guess the question is whether or not that documentation should be duplicated elsewhere. Thank you Tim, this is precisely what I was looking for! I can only see one issue with the current docs (if you excuse me for bothering you with such ...
2019-01-30T13:13:20Z
3.0
["test_override_file_upload_permissions (test_utils.tests.OverrideSettingsTests)"]
["test_allowed_database_chunked_cursor_queries (test_utils.tests.AllowedDatabaseQueriesTests)", "test_allowed_database_queries (test_utils.tests.AllowedDatabaseQueriesTests)", "test_skip_if_db_feature (test_utils.tests.SkippingTestCase)", "test_skip_unless_db_feature (test_utils.tests.SkippingTestCase)", "test_equal_pa...
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
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 ...
2019-02-11T01:19:56Z
3.0
["test_accent (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_basic (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_column (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_nopass (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "SIGINT is ignored in Py...
[]
419a78300f7cd27611196e1e464d50fd0385ff27
15 min - 1 hour
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.0
["test_negative (utils_tests.test_dateparse.DurationParseTests)", "test_parse_postgresql_format (utils_tests.test_dateparse.DurationParseTests)"]
["test_parse_date (utils_tests.test_dateparse.DateParseTests)", "test_parse_datetime (utils_tests.test_dateparse.DateParseTests)", "test_parse_time (utils_tests.test_dateparse.DateParseTests)", "test_days (utils_tests.test_dateparse.DurationParseTests)", "test_fractions_of_seconds (utils_tests.test_dateparse.DurationPa...
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
django/django
django__django-11066
4b45b6c8e4d7c9701a332e80d3b1c84209dc36e2
diff --git a/django/contrib/contenttypes/management/__init__.py b/django/contrib/contenttypes/management/__init__.py --- a/django/contrib/contenttypes/management/__init__.py +++ b/django/contrib/contenttypes/management/__init__.py @@ -24,7 +24,7 @@ def _rename(self, apps, schema_editor, old_model, new_model): ...
diff --git a/tests/contenttypes_tests/test_operations.py b/tests/contenttypes_tests/test_operations.py --- a/tests/contenttypes_tests/test_operations.py +++ b/tests/contenttypes_tests/test_operations.py @@ -14,11 +14,16 @@ ), ) class ContentTypeOperationsTests(TransactionTestCase): + databases = {'default', '...
RenameContentType._rename() doesn't save the content type on the correct database Description The commit in question: ​https://github.com/django/django/commit/f179113e6cbc8ba0a8d4e87e1d4410fb61d63e75 The specific lines in question: ​https://github.com/django/django/blob/586a9dc4295357de1f5ad0590ad34bf2bc008f79/django...
Added a pull request with the fix. ​https://github.com/django/django/pull/10332 Hi, I spent all afternoon into this ticket. As I am a newbie I failed to make a test for it. And the fix can really be 'using=db' in the .save() method. But I found a StackOverflow answer about transaction.atomic(using=db) that is interesti...
2019-03-09T13:03:14Z
3.0
["test_existing_content_type_rename_other_database (contenttypes_tests.test_operations.ContentTypeOperationsTests)"]
["test_content_type_rename_conflict (contenttypes_tests.test_operations.ContentTypeOperationsTests)", "test_existing_content_type_rename (contenttypes_tests.test_operations.ContentTypeOperationsTests)", "test_missing_content_type_rename_ignore (contenttypes_tests.test_operations.ContentTypeOperationsTests)"]
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
django/django
django__django-11087
8180ffba21bf10f4be905cb0d4890dc2bcff2788
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 @@ -1,4 +1,5 @@ from collections import Counter +from itertools import chain from operator import attrgetter from django.db import IntegrityError, connections, transaction ...
diff --git a/tests/delete/models.py b/tests/delete/models.py --- a/tests/delete/models.py +++ b/tests/delete/models.py @@ -126,3 +126,20 @@ class Base(models.Model): class RelToBase(models.Model): base = models.ForeignKey(Base, models.DO_NOTHING) + + +class Origin(models.Model): + pass + + +class Referrer(mo...
Optimize .delete() to use only required fields. Description Hi! We're in the process of upgrading our Django 1.11 installation from Python 2.7 to Python 3.6, however are hitting an unexpected UnicodeDecodeError during a .delete() run by our daily data purging management command. STR: Have an existing Django 1.11 proj...
I think this would have been better posted elsewhere. See TicketClosingReasons/UseSupportChannels. However... Create some instances: >>> Group.objects.create(name="a") INSERT INTO "auth_group" ("name") VALUES ('a') RETURNING "auth_group"."id"; args=('a',) [utils.py:111] <Group: a> >>> Group.objects.create(name="b") INS...
2019-03-16T22:59:57Z
3.0
["test_only_referenced_fields_selected (delete.tests.DeletionTests)"]
["test_fast_delete_empty_no_update_can_self_select (delete.tests.FastDeleteTests)", "test_fast_delete_fk (delete.tests.FastDeleteTests)", "test_fast_delete_inheritance (delete.tests.FastDeleteTests)", "test_fast_delete_instance_set_pk_none (delete.tests.FastDeleteTests)", "test_fast_delete_joined_qs (delete.tests.FastD...
419a78300f7cd27611196e1e464d50fd0385ff27
15 min - 1 hour
django/django
django__django-11095
7d49ad76562e8c0597a0eb66046ab423b12888d8
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 @@ -327,6 +327,10 @@ def get_fieldsets(self, request, obj=None): return self.fieldsets return [(None, {'fields': self.get_fields(request, obj)}...
diff --git a/tests/generic_inline_admin/tests.py b/tests/generic_inline_admin/tests.py --- a/tests/generic_inline_admin/tests.py +++ b/tests/generic_inline_admin/tests.py @@ -429,3 +429,29 @@ class EpisodeAdmin(admin.ModelAdmin): inlines = ma.get_inline_instances(request) for (formset, inline), other_...
add ModelAdmin.get_inlines() hook to allow set inlines based on the request or model instance. Description add ModelAdmin.get_inlines() hook to allow set inlines based on the request or model instance. Currently, We can override the method get_inline_instances to do such a thing, but a for loop should be copied to my...
Are you going to offer a patch to show exactly what you have in mind? I'm not immediately convinced that another hook is needed since the cost of duplicating a for loop is not that great. If I want to realize a dynamic inlines based on the request or model instance. I need to override get_inline_instances to do it. Wha...
2019-03-19T15:17:28Z
3.0
["test_get_inline_instances_override_get_inlines (generic_inline_admin.tests.GenericInlineModelAdminTest)"]
["test_no_deletion (generic_inline_admin.tests.NoInlineDeletionTest)", "test_custom_form_meta_exclude (generic_inline_admin.tests.GenericInlineModelAdminTest)", "test_custom_form_meta_exclude_with_readonly (generic_inline_admin.tests.GenericInlineModelAdminTest)", "test_get_fieldsets (generic_inline_admin.tests.Generic...
419a78300f7cd27611196e1e464d50fd0385ff27
15 min - 1 hour
django/django
django__django-11099
d26b2424437dabeeca94d7900b37d2df4410da0c
diff --git a/django/contrib/auth/validators.py b/django/contrib/auth/validators.py --- a/django/contrib/auth/validators.py +++ b/django/contrib/auth/validators.py @@ -7,7 +7,7 @@ @deconstructible class ASCIIUsernameValidator(validators.RegexValidator): - regex = r'^[\w.@+-]+$' + regex = r'^[\w.@+-]+\Z' m...
diff --git a/tests/auth_tests/test_validators.py b/tests/auth_tests/test_validators.py --- a/tests/auth_tests/test_validators.py +++ b/tests/auth_tests/test_validators.py @@ -237,7 +237,7 @@ def test_unicode_validator(self): invalid_usernames = [ "o'connell", "عبد ال", "zerowidth\u200...
UsernameValidator allows trailing newline in usernames Description ASCIIUsernameValidator and UnicodeUsernameValidator use the regex r'^[\w.@+-]+$' The intent is to only allow alphanumeric characters as well as ., @, +, and -. However, a little known quirk of Python regexes is that $ will also match a trailing newli...
2019-03-20T03:46:18Z
3.0
["test_ascii_validator (auth_tests.test_validators.UsernameValidatorsTests)", "test_unicode_validator (auth_tests.test_validators.UsernameValidatorsTests)", "test_help_text (auth_tests.test_validators.UserAttributeSimilarityValidatorTest)"]
["test_help_text (auth_tests.test_validators.MinimumLengthValidatorTest)", "test_validate (auth_tests.test_validators.MinimumLengthValidatorTest)", "test_help_text (auth_tests.test_validators.NumericPasswordValidatorTest)", "test_validate (auth_tests.test_validators.NumericPasswordValidatorTest)", "test_validate (auth_...
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
django/django
django__django-11119
d4df5e1b0b1c643fe0fc521add0236764ec8e92a
diff --git a/django/template/engine.py b/django/template/engine.py --- a/django/template/engine.py +++ b/django/template/engine.py @@ -160,7 +160,7 @@ def render_to_string(self, template_name, context=None): if isinstance(context, Context): return t.render(context) else: - retu...
diff --git a/tests/template_tests/test_engine.py b/tests/template_tests/test_engine.py --- a/tests/template_tests/test_engine.py +++ b/tests/template_tests/test_engine.py @@ -21,6 +21,13 @@ def test_basic_context(self): 'obj:test\n', ) + def test_autoescape_off(self): + engine = Engine...
Engine.render_to_string() should honor the autoescape attribute Description In Engine.render_to_string, a Context is created without specifying the engine autoescape attribute. So if you create en engine with autoescape=False and then call its render_to_string() method, the result will always be autoescaped. It was p...
I'd like to reserve this for an event I'll attend on Oct 4th.
2019-03-24T21:17:05Z
3.0
["test_autoescape_off (template_tests.test_engine.RenderToStringTest)"]
["test_cached_loader_priority (template_tests.test_engine.LoaderTests)", "test_loader_priority (template_tests.test_engine.LoaderTests)", "test_origin (template_tests.test_engine.LoaderTests)", "test_basic_context (template_tests.test_engine.RenderToStringTest)", "test_multiple_engines_configured (template_tests.test_e...
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
django/django
django__django-11133
879cc3da6249e920b8d54518a0ae06de835d7373
diff --git a/django/http/response.py b/django/http/response.py --- a/django/http/response.py +++ b/django/http/response.py @@ -229,7 +229,7 @@ def make_bytes(self, value): # Handle string types -- we can't rely on force_bytes here because: # - Python attempts str conversion first # - when sel...
diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py --- a/tests/httpwrappers/tests.py +++ b/tests/httpwrappers/tests.py @@ -366,6 +366,10 @@ def test_non_string_content(self): r.content = 12345 self.assertEqual(r.content, b'12345') + def test_memoryview_content(self): + ...
HttpResponse doesn't handle memoryview objects Description I am trying to write a BinaryField retrieved from the database into a HttpResponse. When the database is Sqlite this works correctly, but Postgresql returns the contents of the field as a memoryview object and it seems like current Django doesn't like this co...
I guess HttpResponseBase.make_bytes ​could be adapted to deal with memoryview objects by casting them to bytes. In all cases simply wrapping the memoryview in bytes works as a workaround HttpResponse(bytes(model.binary_field)). The fact make_bytes would still use force_bytes if da56e1bac6449daef9aeab8d076d2594d9fd5b44 ...
2019-03-27T06:48:09Z
3.0
["test_memoryview_content (httpwrappers.tests.HttpResponseTests)"]
["test_streaming_response (httpwrappers.tests.StreamingHttpResponseTests)", "test_cookie_edgecases (httpwrappers.tests.CookieTests)", "Semicolons and commas are decoded.", "Semicolons and commas are encoded.", "test_httponly_after_load (httpwrappers.tests.CookieTests)", "test_invalid_cookies (httpwrappers.tests.CookieT...
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
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.0
["test_query_convert_timezones (timezones.tests.NewDatabaseTests)"]
["test_aware_datetime_in_utc (timezones.tests.SerializationTests)", "test_naive_datetime (timezones.tests.SerializationTests)", "test_naive_datetime_with_microsecond (timezones.tests.SerializationTests)", "test_auto_now_and_auto_now_add (timezones.tests.LegacyDatabaseTests)", "test_aware_datetime_unsupported (timezones...
419a78300f7cd27611196e1e464d50fd0385ff27
1-4 hours
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...
2019-03-28T20:49:53Z
3.1
["Migration directories without an __init__.py file are loaded."]
["test_apply (migrations.test_loader.RecorderTests)", "test_invalid (migrations.test_loader.PycLoaderTests)", "test_valid (migrations.test_loader.PycLoaderTests)", "test_check_consistent_history (migrations.test_loader.LoaderTests)", "test_check_consistent_history_squashed (migrations.test_loader.LoaderTests)", "test_e...
0668164b4ac93a5be79f5b87fae83c657124d9ab
15 min - 1 hour
django/django
django__django-11149
e245046bb6e8b32360aa48b8a41fb7050f0fc730
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 @@ -2111,46 +2111,50 @@ def get_queryset(self, request): queryset = queryset.none() return queryset + def _has_any_perms_for_target_model(...
diff --git a/tests/admin_inlines/models.py b/tests/admin_inlines/models.py --- a/tests/admin_inlines/models.py +++ b/tests/admin_inlines/models.py @@ -37,6 +37,9 @@ def __str__(self): class Book(models.Model): name = models.CharField(max_length=50) + def __str__(self): + return self.name + class Au...
Admin inlines for auto-created ManyToManyFields are editable if the user only has the view permission Description From https://code.djangoproject.com/ticket/8060#comment:34 Replying to Will Gordon: This seems to have regressed in (at least) 2.1. I have 2 view only permissions. I have a ManyToManyField represented in ...
OK, yes. Fleshing it out I can reproduce this against 2.1.7 with the models and inline provided. A user with only the view permission for both Report and Photo can edit the M2M in the inline. When the M2M is handled as a normal field, rather than an inline, the behaviour is correct. Elevating to a Release Blocker as a ...
2019-03-30T18:14:35Z
3.0
["test_inline_add_m2m_view_only_perm (admin_inlines.tests.TestInlinePermissions)", "test_inline_change_m2m_view_only_perm (admin_inlines.tests.TestInlinePermissions)"]
["Regression for #9362", "test_deleting_inline_with_protected_delete_does_not_validate (admin_inlines.tests.TestInlineProtectedOnDelete)", "test_all_inline_media (admin_inlines.tests.TestInlineMedia)", "test_inline_media_only_base (admin_inlines.tests.TestInlineMedia)", "test_inline_media_only_inline (admin_inlines.tes...
419a78300f7cd27611196e1e464d50fd0385ff27
15 min - 1 hour
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.0
["test_modelform_subclassed_model (model_forms.tests.ModelOneToOneFieldTests)"]
["test_modelform_factory_metaclass (model_forms.tests.CustomMetaclassTestCase)", "test_setattr_raises_validation_error_field_specific (model_forms.tests.StrictAssignmentTests)", "test_setattr_raises_validation_error_non_field (model_forms.tests.StrictAssignmentTests)", "test_notrequired_overrides_notblank (model_forms....
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
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.0
["test_fast_delete_instance_set_pk_none (delete.tests.FastDeleteTests)"]
["test_fast_delete_empty_no_update_can_self_select (delete.tests.FastDeleteTests)", "test_fast_delete_fk (delete.tests.FastDeleteTests)", "test_fast_delete_inheritance (delete.tests.FastDeleteTests)", "test_fast_delete_joined_qs (delete.tests.FastDeleteTests)", "test_fast_delete_large_batch (delete.tests.FastDeleteTest...
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
django/django
django__django-11206
571ab44e8a8936014c22e7eebe4948d9611fd7ce
diff --git a/django/utils/numberformat.py b/django/utils/numberformat.py --- a/django/utils/numberformat.py +++ b/django/utils/numberformat.py @@ -27,6 +27,14 @@ def format(number, decimal_sep, decimal_pos=None, grouping=0, thousand_sep='', # sign sign = '' if isinstance(number, Decimal): + + if d...
diff --git a/tests/utils_tests/test_numberformat.py b/tests/utils_tests/test_numberformat.py --- a/tests/utils_tests/test_numberformat.py +++ b/tests/utils_tests/test_numberformat.py @@ -94,7 +94,7 @@ def test_decimal_numbers(self): ('1e-10', 8, '0.00000000'), ('1e-11', 8, '0.00000000'), ...
utils.numberformat.format renders small decimals in exponential notation. Description When using utils.number_format with decimal_pos, extremely small numbers get displayed using exponential notation. >>> from django.utils.numberformat import format as nformat >>> nformat(Decimal('1e-199'), '.', decimal_pos=2) '0.00'...
Hi Sjoerd. OK, so this is related to the changes in 9cc6a60040b0f64f8ea066dd215176d4bd16621d. Happy to Accept as a potential Cleanup/optimization — I guess ultimately it depends on what the change looks like. (i.e. is the nicer behaviour worth the extra complexity? etc) I'm assuming you're ready/willing to make the pat...
2019-04-13T10:19:38Z
3.0
["test_decimal_numbers (utils_tests.test_numberformat.TestNumberFormat)", "test_decimal_subclass (utils_tests.test_numberformat.TestNumberFormat)"]
["test_float_numbers (utils_tests.test_numberformat.TestNumberFormat)", "test_format_number (utils_tests.test_numberformat.TestNumberFormat)", "test_format_string (utils_tests.test_numberformat.TestNumberFormat)", "test_large_number (utils_tests.test_numberformat.TestNumberFormat)"]
419a78300f7cd27611196e1e464d50fd0385ff27
15 min - 1 hour
django/django
django__django-11211
ba726067604ce5a8ca3919edf653496722b433ab
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 @@ -2325,6 +2325,10 @@ def deconstruct(self): def get_internal_type(self): return "UUIDField" + def get_prep_value(self, value): +...
diff --git a/tests/prefetch_related/models.py b/tests/prefetch_related/models.py --- a/tests/prefetch_related/models.py +++ b/tests/prefetch_related/models.py @@ -172,6 +172,11 @@ def __str__(self): return self.tag +class Article(models.Model): + id = models.UUIDField(primary_key=True, default=uuid.uuid...
Prefetch related is not working when used GFK for model that uses UUID field as PK. Description How to reproduce: create model with UUID as primary key class Foo(models.Model): id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) ... create another model with GFK to model Foo class Bar(models...
Thanks for the report, however GenericForeignKey doesn't support prefetch_related(), from the same reason it doesn't not support also filter(), exclude(), etc. Please see ​documentation.
2019-04-13T12:01:14Z
3.0
["test_prefetch_GFK_uuid_pk (prefetch_related.tests.GenericRelationTests)"]
["test_bug (prefetch_related.tests.Ticket21410Tests)", "test_basic (prefetch_related.tests.RawQuerySetTests)", "test_clear (prefetch_related.tests.RawQuerySetTests)", "test_prefetch_before_raw (prefetch_related.tests.RawQuerySetTests)", "test_bug (prefetch_related.tests.Ticket19607Tests)", "test_m2m_then_m2m (prefetch_...
419a78300f7cd27611196e1e464d50fd0385ff27
15 min - 1 hour
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...
2019-04-16T09:44:54Z
3.0
["test_ssl_certificate (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)"]
["test_accent (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_basic (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_column (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_nopass (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "SIGINT is ignored in Py...
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
django/django
django__django-11265
21aa2a5e785eef1f47beb1c3760fdd7d8915ae09
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 @@ -1666,6 +1666,7 @@ def split_exclude(self, filter_expr, can_reuse, names_with_path): filter_expr = (filter_lhs, OuterRef(filter_rhs.name)) # Generat...
diff --git a/tests/filtered_relation/tests.py b/tests/filtered_relation/tests.py --- a/tests/filtered_relation/tests.py +++ b/tests/filtered_relation/tests.py @@ -98,6 +98,14 @@ def test_with_join(self): [self.author1] ) + def test_with_exclude(self): + self.assertSequenceEqual( + ...
Using exclude on annotated FilteredRelation doesn't work Description It looks like using exclude on queryset with annotated FilteredRelation give a FieldError on the annotation name. For exemple, in Django tests (django/tests/filtered_relation/tests.py) if we change this : def test_with_join(self): self.assertSequen...
I've submitted a PR: ​PR Patch looks good but it looks like doesn't qualify for a backport given FilteredRelation was introduced in Django 2.0 and isn't considered a new feature at this point. Hi, i've tested the solution you're giving in your PR but it doesn't seams to be ok, let me explain. Even if the error is not t...
2019-04-21T12:57:28Z
3.0
["test_with_exclude (filtered_relation.tests.FilteredRelationTests)"]
["test_aggregate (filtered_relation.tests.FilteredRelationAggregationTests)", "test_as_subquery (filtered_relation.tests.FilteredRelationTests)", "test_defer (filtered_relation.tests.FilteredRelationTests)", "test_difference (filtered_relation.tests.FilteredRelationTests)", "test_exclude_relation_with_join (filtered_re...
419a78300f7cd27611196e1e464d50fd0385ff27
15 min - 1 hour
django/django
django__django-11276
28d5262fa3315690395f04e3619ed554dbaf725b
diff --git a/django/utils/html.py b/django/utils/html.py --- a/django/utils/html.py +++ b/django/utils/html.py @@ -1,5 +1,6 @@ """HTML utilities suitable for global use.""" +import html import json import re from html.parser import HTMLParser @@ -24,14 +25,6 @@ simple_url_re = re.compile(r'^https?://\[?\w', re.I...
diff --git a/tests/admin_docs/test_views.py b/tests/admin_docs/test_views.py --- a/tests/admin_docs/test_views.py +++ b/tests/admin_docs/test_views.py @@ -199,7 +199,7 @@ def test_methods_with_arguments_display_arguments_default_value(self): """ Methods with keyword arguments should have their argumen...
Use Python stdlib html.escape() to in django.utils.html.escape() Description The function django.utils.html.escape() partially duplicates the Python stdlib function html.escape(). We can replace this duplication with wider community developed version. html.escape() has been available since Python 3.2: ​https://docs.p...
2019-04-24T12:35:05Z
3.0
["test_make_list02 (template_tests.filter_tests.test_make_list.MakeListTests)", "test_password_help_text (auth_tests.test_forms.UserCreationFormTest)", "test_url_split_chars (template_tests.filter_tests.test_urlize.FunctionTests)", "test_wrapping_characters (template_tests.filter_tests.test_urlize.FunctionTests)", "tes...
["test_missing_passwords (auth_tests.test_forms.AdminPasswordChangeFormTest)", "test_non_matching_passwords (auth_tests.test_forms.AdminPasswordChangeFormTest)", "test_one_password (auth_tests.test_forms.AdminPasswordChangeFormTest)", "test_password_whitespace_not_stripped (auth_tests.test_forms.AdminPasswordChangeForm...
419a78300f7cd27611196e1e464d50fd0385ff27
15 min - 1 hour
django/django
django__django-11292
eb16c7260e573ec513d84cb586d96bdf508f3173
diff --git a/django/core/management/base.py b/django/core/management/base.py --- a/django/core/management/base.py +++ b/django/core/management/base.py @@ -95,7 +95,7 @@ class DjangoHelpFormatter(HelpFormatter): """ show_last = { '--version', '--verbosity', '--traceback', '--settings', '--pythonpath',...
diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py --- a/tests/user_commands/tests.py +++ b/tests/user_commands/tests.py @@ -253,6 +253,16 @@ def test_disallowed_abbreviated_options(self): self.assertNoOutput(err) self.assertEqual(out.strip(), 'Set foo') + def test_skip_chec...
Add --skip-checks option to management commands. Description Management commands already have skip_checks stealth option. I propose exposing this option on the command line. This would allow users to skip checks when running a command from the command line. Sometimes in a development environment, it is nice to move a...
2019-04-27T14:23:07Z
3.0
["test_skip_checks (user_commands.tests.CommandRunTests)"]
["test_get_random_secret_key (user_commands.tests.UtilsTests)", "test_is_ignored_path_false (user_commands.tests.UtilsTests)", "test_is_ignored_path_true (user_commands.tests.UtilsTests)", "test_no_existent_external_program (user_commands.tests.UtilsTests)", "test_normalize_path_patterns_truncates_wildcard_base (user_c...
419a78300f7cd27611196e1e464d50fd0385ff27
15 min - 1 hour
django/django
django__django-11299
6866c91b638de5368c18713fa851bfe56253ea55
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 @@ -1338,7 +1338,7 @@ def _add_q(self, q_object, used_aliases, branch_negated=False, if isinstance(child, Node): child_clause, needed_inner = s...
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py --- a/tests/migrations/test_operations.py +++ b/tests/migrations/test_operations.py @@ -1898,6 +1898,29 @@ def test_add_constraint_percent_escaping(self): author = Author.objects.create(name='Albert', rebate='10%') ...
CheckConstraint with OR operator generates incorrect SQL on SQLite and Oracle. Description (last modified by Michael Spallino) Django is incorrectly including the fully qualified field name(e.g. “my_table”.”my_field”) in part of the check constraint. This only appears to happen when there is a combination of OR...
Could you confirm this also happens on other backends than SQLite? ​PR The patch changes are looking great. I left a suggestion to simply one the tests assertions to make them easier to parse by a human but they are testing the right thing.
2019-04-28T11:15:08Z
3.0
["test_simplecol_query (queries.test_query.TestQuery)"]
["test_reference_field_by_through_fields (migrations.test_operations.FieldOperationTests)", "test_references_field_by_from_fields (migrations.test_operations.FieldOperationTests)", "test_references_field_by_name (migrations.test_operations.FieldOperationTests)", "test_references_field_by_remote_field_model (migrations....
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
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.0
["test_resolver_cache_default__root_urlconf (urlpatterns.test_resolvers.ResolverCacheTests)"]
["test_str (urlpatterns.test_resolvers.RegexPatternTests)", "test_str (urlpatterns.test_resolvers.RoutePatternTests)"]
419a78300f7cd27611196e1e464d50fd0385ff27
15 min - 1 hour
django/django
django__django-11400
1f8382d34d54061eddc41df6994e20ee38c60907
diff --git a/django/contrib/admin/filters.py b/django/contrib/admin/filters.py --- a/django/contrib/admin/filters.py +++ b/django/contrib/admin/filters.py @@ -193,11 +193,17 @@ def has_output(self): def expected_parameters(self): return [self.lookup_kwarg, self.lookup_kwarg_isnull] - def field_choice...
diff --git a/tests/admin_filters/tests.py b/tests/admin_filters/tests.py --- a/tests/admin_filters/tests.py +++ b/tests/admin_filters/tests.py @@ -591,6 +591,22 @@ class BookAdmin(ModelAdmin): expected = [(self.john.pk, 'John Blue'), (self.jack.pk, 'Jack Red')] self.assertEqual(filterspec.lookup_choic...
Ordering problem in admin.RelatedFieldListFilter and admin.RelatedOnlyFieldListFilter Description RelatedFieldListFilter doesn't fall back to the ordering defined in Model._meta.ordering. Ordering gets set to an empty tuple in ​https://github.com/django/django/blob/2.2.1/django/contrib/admin/filters.py#L196 and unle...
Sample project illustrating the problem. Navigate to /admin/foo/book and observer the order of Author in the list filters. Screenshot of RelatedOnlyFieldListFilter not ordering items. OK, yes, seems a reasonable suggestion if you'd like to work on it. Hello. We've updated our django recently and faced this bug. For me ...
2019-05-22T11:30:39Z
3.0
["test_get_choices_default_ordering (model_fields.tests.GetChoicesOrderingTests)", "test_get_choices_reverse_related_field_default_ordering (model_fields.tests.GetChoicesOrderingTests)", "RelatedFieldListFilter ordering respects Model.ordering.", "test_relatedfieldlistfilter_reverse_relationships_default_ordering (admi...
["test_choices_and_field_display (model_fields.tests.GetFieldDisplayTests)", "test_empty_iterator_choices (model_fields.tests.GetFieldDisplayTests)", "A translated display value is coerced to str.", "test_iterator_choices (model_fields.tests.GetFieldDisplayTests)", "test_check (model_fields.tests.ChoicesTests)", "test_...
419a78300f7cd27611196e1e464d50fd0385ff27
1-4 hours
django/django
django__django-11433
21b1d239125f1228e579b1ce8d94d4d5feadd2a6
diff --git a/django/forms/models.py b/django/forms/models.py --- a/django/forms/models.py +++ b/django/forms/models.py @@ -48,8 +48,11 @@ def construct_instance(form, instance, fields=None, exclude=None): continue # Leave defaults for fields that aren't in POST data, except for # checkbox...
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 @@ -585,6 +585,32 @@ class Meta: m2 = mf2.save(commit=False) self.assertEqual(m2.mode, '') + def test_default_not_populated_on_non_empty_value_in_cleaned_data(sel...
Allow `cleaned_data` to overwrite fields' default values. Description See comments here: ​https://github.com/django/django/pull/7068/files#r289432409 Currently, when submitting a form, if 'some_field' isn't in the data payload (e.g. it wasn't included in the form, perhaps because its value is derived from another fie...
2019-05-31T17:06:20Z
3.0
["test_default_not_populated_on_non_empty_value_in_cleaned_data (model_forms.tests.ModelFormBaseTest)"]
["test_model_form_clean_applies_to_model (model_forms.tests.CustomCleanTests)", "test_override_clean (model_forms.tests.CustomCleanTests)", "test_model_form_applies_localize_to_all_fields (model_forms.tests.LocalizedModelFormTest)", "test_model_form_applies_localize_to_some_fields (model_forms.tests.LocalizedModelFormT...
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
django/django
django__django-11451
e065b293878b1e3ea56655aa9d33e87576cd77ff
diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py --- a/django/contrib/auth/backends.py +++ b/django/contrib/auth/backends.py @@ -39,6 +39,8 @@ class ModelBackend(BaseBackend): def authenticate(self, request, username=None, password=None, **kwargs): if username is None: ...
diff --git a/tests/auth_tests/test_auth_backends.py b/tests/auth_tests/test_auth_backends.py --- a/tests/auth_tests/test_auth_backends.py +++ b/tests/auth_tests/test_auth_backends.py @@ -226,6 +226,19 @@ def test_authentication_timing(self): authenticate(username='no_such_user', password='test') self....
ModelBackend.authenticate() shouldn't make a database query when username is None Description It's easier to explain my issue by adding a comment in the current implementation of ModelBackend.authenticate(): def authenticate(self, request, username=None, password=None, **kwargs): if username is None: username =...
2019-06-08T19:11:42Z
3.0
["test_authentication_without_credentials (auth_tests.test_auth_backends.ModelBackendTest)", "test_custom_perms (auth_tests.test_auth_backends.ModelBackendTest)", "test_authentication_without_credentials (auth_tests.test_auth_backends.CustomPermissionsUserModelBackendTest)", "test_custom_perms (auth_tests.test_auth_bac...
["test_raises_exception (auth_tests.test_auth_backends.NoBackendsTest)", "test_get_all_permissions (auth_tests.test_auth_backends.BaseBackendTest)", "test_get_group_permissions (auth_tests.test_auth_backends.BaseBackendTest)", "test_get_user_permissions (auth_tests.test_auth_backends.BaseBackendTest)", "test_has_perm (...
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix