python 3.8: `test_date*_behaves_like_date*` tests fail with AttributeError
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 55/100
Research direction
Start with the failing tests in tests/test_items.py, then inspect the DateTime and Date implementations in tomlkit/items.py around the reported lines. Reproduce the failures on Python 3.8 and verify that the date and datetime behavior tests pass while preserving the shown comparisons and string output.
Written by the indexing model from the issue text.
Description
=================================== FAILURES ===================================
_____________________ test_datetimes_behave_like_datetimes _____________________
def test_datetimes_behave_like_datetimes():
i = item(datetime(2018, 7, 22, 12, 34, 56))
assert i == datetime(2018, 7, 22, 12, 34, 56)
assert i.as_string() == "2018-07-22T12:34:56"
> i += timedelta(days=1)
tests/test_items.py:275:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tomlkit/items.py:525: in __add__
result = super(DateTime, self).__add__(other)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'tomlkit.items.DateTime'>, value = 2018
_ = (7, 23, 12, 34, 56, 0, ...)
def __new__(cls, value, *_): # type: (..., datetime, ...) -> datetime
return datetime.__new__(
cls,
> value.year,
value.month,
value.day,
value.hour,
value.minute,
value.second,
value.microsecond,
tzinfo=value.tzinfo,
)
E AttributeError: 'int' object has no attribute 'year'
tomlkit/items.py:498: AttributeError
_________________________ test_dates_behave_like_dates _________________________
def test_dates_behave_like_dates():
i = item(date(2018, 7, 22))
assert i == date(2018, 7, 22)
assert i.as_string() == "2018-07-22"
> i += timedelta(days=1)
tests/test_items.py:295:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tomlkit/items.py:584: in __add__
result = super(Date, self).__add__(other)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
cls = <class 'tomlkit.items.Date'>, value = 2018, _ = (7, 23)
def __new__(cls, value, *_): # type: (..., date, ...) -> date
> return date.__new__(cls, value.year, value.month, value.day)
E AttributeError: 'int' object has no attribute 'year'
tomlkit/items.py:565: AttributeError
- Dominant language
- Python
- Stars
- 850
- Forks
- 163
- Avg merge
- 13m
- Merged PRs (30d)
- 2
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python-poetry/tomlkit
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
python-poetry/tomlkit#546 · 2 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 68/100
python-poetry/tomlkit#603 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 52/100
python-poetry/tomlkit#580 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 72/100
python-poetry/tomlkit#577 ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
python-poetry/tomlkit#574 · 5 comments ·
All issues in python-poetry/tomlkit
Similar issues
-
bug confirmed issue
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
open-webui/open-webui#30750 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
OpenwaterHealth/openmotion-bloodflow-app#604 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
good first issue
Difficulty 1/5 Under an hour Newbie friendliness 90/100