changeset cef02787c3f7 in modules/attendance:default
details: 
https://hg.tryton.org/modules/attendance?cmd=changeset;node=cef02787c3f7
description:
        Do not use timedelta __repr__ in scenario

        The __repr__ has changed since Python 3.7 so we can not rely on it and 
we must
        use equality comparison.
diffstat:

 tests/scenario_attendance_sheet.rst     |  17 +++++++++--------
 tests/scenario_attendance_timesheet.rst |  14 +++++++-------
 2 files changed, 16 insertions(+), 15 deletions(-)

diffs (68 lines):

diff -r 035033e0bd8f -r cef02787c3f7 tests/scenario_attendance_sheet.rst
--- a/tests/scenario_attendance_sheet.rst       Wed May 20 23:44:20 2020 +0200
+++ b/tests/scenario_attendance_sheet.rst       Thu May 21 00:09:13 2020 +0200
@@ -55,14 +55,15 @@
 
     >>> Sheet = Model.get('attendance.sheet')
     >>> sheet, = Sheet.find([])
-    >>> sheet.duration
-    datetime.timedelta(0, 28800)
+    >>> sheet.duration == dt.timedelta(hours=8)
+    True
     >>> sheet.date
     datetime.date(2020, 4, 1)
     >>> len(sheet.lines)
     3
-    >>> sum([l.duration for l in sheet.lines], dt.timedelta())
-    datetime.timedelta(0, 28800)
+    >>> (sum([l.duration for l in sheet.lines], dt.timedelta()) ==
+    ...     dt.timedelta(hours=8))
+    True
 
 Fill attendance over 1 day::
 
@@ -72,8 +73,8 @@
 Check attendance sheet::
 
     >>> sheet, = Sheet.find([('date', '=', dt.date(2020, 4, 2))])
-    >>> sheet.duration
-    datetime.timedelta(0, 36000)
+    >>> sheet.duration == dt.timedelta(hours=10)
+    True
 
 Add attendance for other employee::
 
@@ -83,5 +84,5 @@
 Check attendance sheet::
 
     >>> sheet, = Sheet.find([('employee', '=', employee2.id)])
-    >>> sheet.duration
-    datetime.timedelta(0, 21600)
+    >>> sheet.duration == dt.timedelta(hours=6)
+    True
diff -r 035033e0bd8f -r cef02787c3f7 tests/scenario_attendance_timesheet.rst
--- a/tests/scenario_attendance_timesheet.rst   Wed May 20 23:44:20 2020 +0200
+++ b/tests/scenario_attendance_timesheet.rst   Thu May 21 00:09:13 2020 +0200
@@ -67,15 +67,15 @@
 
     >>> Sheet = Model.get('attendance.sheet')
     >>> sheet, = Sheet.find([('date', '=', dt.date(2020, 4, 1))])
-    >>> sheet.duration
-    datetime.timedelta(0, 28800)
-    >>> sheet.timesheet_duration
-    datetime.timedelta(0, 25200)
+    >>> sheet.duration == dt.timedelta(hours=8)
+    True
+    >>> sheet.timesheet_duration == dt.timedelta(hours=7)
+    True
 
     >>> if backend.name != 'sqlite':
     ...     sheet, = Sheet.find([('date', '=', dt.date(2020, 4, 2))])
     ...     sheet.duration
-    ...     sheet.timesheet_duration
+    ...     sheet.timesheet_duration == dt.timedelta(hours=2)
     ... else:
-    ...     dt.timedelta(0, 7200)
-    datetime.timedelta(0, 7200)
+    ...     True
+    True

Reply via email to