Visitar URL original
gh-103636: issue warning for deprecated calendar constants by Agent-Hellboy · Pull Request #103833 · python/cpython · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fix grametical mistake
  • Loading branch information
Agent-Hellboy committed Apr 27, 2023
commit e002e109f57278eb52f0716bc026b38b15c11472
42 changes: 2 additions & 40 deletions Doc/library/calendar.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,89 +30,51 @@ interpreted as prescribed by the ISO 8601 standard. Year 0 is 1 BC, year -1 is

.. class:: Day

This enumeration defines the days of the week as integer constants.
Enumeration defining the days of the week as integer constants, from 0 to 6.

.. attribute:: MONDAY

The constant for Monday, with a value of 0.

.. attribute:: TUESDAY

The constant for Tuesday, with a value of 1.

.. attribute:: WEDNESDAY

The constant for Wednesday, with a value of 2.

.. attribute:: THURSDAY

The constant for Thursday, with a value of 3.

.. attribute:: FRIDAY

The constant for Friday, with a value of 4.

.. attribute:: SATURDAY

The constant for Saturday, with a value of 5.

.. attribute:: SUNDAY
Comment thread
Agent-Hellboy marked this conversation as resolved.

The constant for Sunday, with a value of 6.


.. class:: Month

This enumeration defines the months of the year as integer constants.
Enumeration defining months of the year as integer constants, from 1 to 12.

.. attribute:: JANUARY

The constant for January, with a value of 1.

.. attribute:: FEBRUARY

The constant for February, with a value of 2.

.. attribute:: MARCH

The constant for March, with a value of 3.

.. attribute:: APRIL

The constant for April, with a value of 4.

.. attribute:: MAY

The constant for May, with a value of 5.

.. attribute:: JUNE

The constant for June, with a value of 6.

.. attribute:: JULY

The constant for July, with a value of 7.

.. attribute:: AUGUST

The constant for August, with a value of 8.

.. attribute:: SEPTEMBER

The constant for September, with a value of 9.

.. attribute:: OCTOBER

The constant for October, with a value of 10.

.. attribute:: NOVEMBER

The constant for November, with a value of 11.

.. attribute:: DECEMBER
Comment thread
Agent-Hellboy marked this conversation as resolved.

The constant for December, with a value of 12.


.. class:: Calendar(firstweekday=0)

Expand Down
4 changes: 2 additions & 2 deletions Doc/whatsnew/3.12.rst
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,8 @@ Deprecated
Python 3.14, when ``'data'`` filter will become the default.
See :ref:`tarfile-extraction-filter` for details.

* ``January`` and ``February`` is deprated from :mod:`calendar`
use ``JANUARY`` and ``FEBRUARY`` instead
* ``January`` and ``February`` is deprecated from :mod:`calendar`,
use ``JANUARY`` and ``FEBRUARY`` instead.
Comment thread
Agent-Hellboy marked this conversation as resolved.
Outdated

Pending Removal in Python 3.13
------------------------------
Expand Down
2 changes: 0 additions & 2 deletions Lib/test/test_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,9 +494,7 @@ class CalendarTestCase(unittest.TestCase):

def test_deprecation_warning(self):
with warnings.catch_warnings(record=True) as w:
# Access the deprecated attribute
calendar.January
# Check that a DeprecationWarning was issued
self.assertEqual(len(w), 1)
self.assertEqual(w[0].category, DeprecationWarning)
self.assertIn("The 'January' attribute is deprecated, use 'JANUARY' instead", str(w[0].message))
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
module-level attribute January and February is deprecated
module-level attribute January and February is deprecated from :mod:`calendar`
Comment thread
Agent-Hellboy marked this conversation as resolved.
Outdated