File: test_total_methods.py

package info (click to toggle)
pendulum 3.1.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,780 kB
  • sloc: python: 18,420; makefile: 41
file content (28 lines) | stat: -rw-r--r-- 592 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from __future__ import annotations

import pendulum


def test_in_weeks():
    it = pendulum.duration(days=17)
    assert round(it.total_weeks(), 2) == 2.43


def test_in_days():
    it = pendulum.duration(days=3)
    assert it.total_days() == 3


def test_in_hours():
    it = pendulum.duration(days=3, minutes=72)
    assert it.total_hours() == 73.2


def test_in_minutes():
    it = pendulum.duration(minutes=6, seconds=72)
    assert it.total_minutes() == 7.2


def test_in_seconds():
    it = pendulum.duration(seconds=72, microseconds=123456)
    assert it.total_seconds() == 72.123456