Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
python-docxcompose
Manage
Activity
Members
Labels
Plan
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Debian Python Team
packages
python-docxcompose
Commits
bc300657
Commit
bc300657
authored
9 months ago
by
Andrius Merkys
Browse files
Options
Downloads
Patches
Plain Diff
Fix test failure due to timestamps of different precision (Closes: #1073390)
parent
30987137
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
debian/patches/fix-datetime-comparison.patch
+75
-0
75 additions, 0 deletions
debian/patches/fix-datetime-comparison.patch
debian/patches/series
+1
-0
1 addition, 0 deletions
debian/patches/series
with
76 additions
and
0 deletions
debian/patches/fix-datetime-comparison.patch
0 → 100644
+
75
−
0
View file @
bc300657
Description: Fix test failure due to timestamps of different precision,
see #1073390.
Author: Andrius Merkys <merkys@debian.org>
--- a/tests/test_properties.py
+++ b/tests/test_properties.py
@@ -1,4 +1,4 @@
-from datetime import datetime
+from datetime import datetime, timezone
from docx import Document
from docx.opc.constants import RELATIONSHIP_TYPE as RT
from docx.oxml import parse_xml
@@ -763,12 +763,12 @@
assert props['Text Property'] == 'Foo Bar'
assert props['Number Property'] == 123
assert props['Boolean Property'] is True
- assert props['Date Property'] == datetime(2019, 6, 11, 10, 0)
+ assert props['Date Property'] == datetime(2019, 6, 11, 10, 0, tzinfo=timezone.utc)
assert props.get('Text Property') == 'Foo Bar'
assert props.get('Number Property') == 123
assert props.get('Boolean Property') is True
- assert props.get('Date Property') == datetime(2019, 6, 11, 10, 0)
+ assert props.get('Date Property') == datetime(2019, 6, 11, 10, 0, tzinfo=timezone.utc)
def test_get_doc_property_is_case_insensitive():
@@ -792,8 +792,8 @@
props.add('My Number Property', 123)
assert props.get('My Number Property') == 123
- props.add('My Date Property', datetime(2019, 10, 23, 15, 44, 50))
- assert props.get('My Date Property') == datetime(2019, 10, 23, 15, 44, 50)
+ props.add('My Date Property', datetime(2019, 10, 23, 15, 44, 50, tzinfo=timezone.utc))
+ assert props.get('My Date Property') == datetime(2019, 10, 23, 15, 44, 50, tzinfo=timezone.utc)
def test_add_utf8_property():
@@ -817,8 +817,8 @@
props['Number Property'] = 456
assert props['Number Property'] == 456
- props['Date Property'] = datetime(2019, 10, 20, 12, 0)
- assert props['Date Property'] == datetime(2019, 10, 20, 12, 0)
+ props['Date Property'] = datetime(2019, 10, 20, 12, 0, tzinfo=timezone.utc)
+ assert props['Date Property'] == datetime(2019, 10, 20, 12, 0, tzinfo=timezone.utc)
def test_set_doc_property_is_case_insensitive():
@@ -913,7 +913,7 @@
props = CustomProperties(document)
assert props.values() == [
- 'Foo Bar', 123, True, datetime(2019, 6, 11, 10, 0), 1.1]
+ 'Foo Bar', 123, True, datetime(2019, 6, 11, 10, 0, tzinfo=timezone.utc), 1.1]
def test_doc_properties_items():
@@ -924,7 +924,7 @@
('Text Property', 'Foo Bar'),
('Number Property', 123),
('Boolean Property', True),
- ('Date Property', datetime(2019, 6, 11, 10, 0)),
+ ('Date Property', datetime(2019, 6, 11, 10, 0, tzinfo=timezone.utc)),
('Float Property', 1.1),
]
@@ -933,7 +933,7 @@
assert vt2value(value2vt(42)) == 42
assert vt2value(value2vt(True)) is True
assert vt2value(value2vt(1.1)) == pytest.approx(1.1)
- dt = datetime(2019, 6, 11, 10, 0)
+ dt = datetime(2019, 6, 11, 10, 0, tzinfo=timezone.utc)
assert vt2value(value2vt(dt)) == dt
assert vt2value(value2vt(u'foo')) == u'foo'
assert vt2value(value2vt(u'')) == u''
This diff is collapsed.
Click to expand it.
debian/patches/series
0 → 100644
+
1
−
0
View file @
bc300657
fix-datetime-comparison.patch
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment