Exemple #1
0
def test_diff_in_seconds_negative_no_sign():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.subtract(minutes=1).add(seconds=2)).in_seconds() == 58
Exemple #2
0
def test_diff_in_hours_ensure_is_truncated():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(hours=2).add(seconds=5401)).in_hours() == 3
Exemple #3
0
def test_diff_in_hours_positive():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(hours=2).add(seconds=3672)).in_hours() == 3
Exemple #4
0
def test_diff_in_seconds_positive():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(minutes=1).add(seconds=2)).in_seconds() == 62
Exemple #5
0
def test_diff_in_hours_negative_no_sign():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.subtract(hours=2).add(seconds=3600)).in_hours() == 1
Exemple #6
0
def test_diff_in_minutes_positive_big():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(hours=25).add(minutes=2)).in_minutes() == 62
Exemple #7
0
def test_diff_in_seconds_positive_big():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(hours=2).add(seconds=2)).in_seconds() == 7202
Exemple #8
0
 def test_diff_in_seconds_negative_no_sign(self):
     dt = Time(12, 34, 56)
     self.assertEqual(
         58,
         dt.diff(dt.subtract(minutes=1).add(seconds=2)).in_seconds())
Exemple #9
0
def test_diff_in_minutes_ensure_is_truncated():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(minutes=1).add(seconds=59)).in_minutes() == 1
Exemple #10
0
def test_diff_in_seconds_positive():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(minutes=1).add(seconds=2)).in_seconds() == 62
Exemple #11
0
def test_diff_in_hours_positive():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(hours=2).add(seconds=3672)).in_hours() == 3
Exemple #12
0
def test_diff_in_minutes_negative_with_sign():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.subtract(hours=1).add(minutes=2),
                   False).in_minutes() == -58
Exemple #13
0
def test_diff_in_minutes_positive_big():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(hours=25).add(minutes=2)).in_minutes() == 62
Exemple #14
0
 def test_diff_in_hours_positive(self):
     dt = Time(12, 34, 56)
     self.assertEqual(3,
                      dt.diff(dt.add(hours=2).add(seconds=3672)).in_hours())
Exemple #15
0
def test_diff_in_seconds_negative_no_sign():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.subtract(minutes=1).add(seconds=2)).in_seconds() == 58
Exemple #16
0
 def test_diff_in_seconds_positive_big(self):
     dt = Time(12, 34, 56)
     self.assertEqual(7202,
                      dt.diff(dt.add(hours=2).add(seconds=2)).in_seconds())
Exemple #17
0
def test_diff_in_seconds_ensure_is_truncated():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(seconds=1.9)).in_seconds() == 1
Exemple #18
0
 def test_diff_in_seconds_ensure_is_truncated(self):
     dt = Time(12, 34, 56)
     self.assertEqual(1, dt.diff(dt.add(seconds=1.9)).in_seconds())
Exemple #19
0
 def test_diff_in_hours_negative_no_sign(self):
     dt = Time(12, 34, 56)
     self.assertEqual(
         1,
         dt.diff(dt.subtract(hours=2).add(seconds=3600)).in_hours())
Exemple #20
0
def test_diff_in_hours_ensure_is_truncated():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(hours=2).add(seconds=5401)).in_hours() == 3
Exemple #21
0
 def test_diff_in_hours_ensure_is_truncated(self):
     dt = Time(12, 34, 56)
     self.assertEqual(3,
                      dt.diff(dt.add(hours=2).add(seconds=5401)).in_hours())
Exemple #22
0
def test_diff_in_minutes_negative_with_sign():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.subtract(hours=1).add(minutes=2), False).in_minutes() == -58
Exemple #23
0
 def test_diff_in_minutes_positive_big(self):
     dt = Time(12, 34, 56)
     self.assertEqual(62,
                      dt.diff(dt.add(hours=25).add(minutes=2)).in_minutes())
Exemple #24
0
def test_diff_in_minutes_ensure_is_truncated():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(minutes=1).add(seconds=59)).in_minutes() == 1
Exemple #25
0
 def test_diff_in_minutes_negative_with_sign(self):
     dt = Time(12, 34, 56)
     self.assertEqual(
         -58,
         dt.diff(dt.subtract(hours=1).add(minutes=2), False).in_minutes())
Exemple #26
0
def test_diff_in_seconds_positive_big():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(hours=2).add(seconds=2)).in_seconds() == 7202
Exemple #27
0
 def test_diff_in_seconds_positive(self):
     dt = Time(12, 34, 56)
     self.assertEqual(
         62,
         dt.diff(dt.add(minutes=1).add(seconds=2)).in_seconds())
Exemple #28
0
def test_diff_in_seconds_ensure_is_truncated():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.add(seconds=1.9)).in_seconds() == 1
Exemple #29
0
def test_diff_in_hours_negative_no_sign():
    dt = Time(12, 34, 56)
    assert dt.diff(dt.subtract(hours=2).add(seconds=3600)).in_hours() == 1