MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_divmod

Method test_divmod

Lib/test/datetimetester.py:1010–1025  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1008 self.assertRaises(TypeError, mod, t, 10)
1009
1010 def test_divmod(self):
1011 t = timedelta(minutes=2, seconds=30)
1012 minute = timedelta(minutes=1)
1013 q, r = divmod(t, minute)
1014 self.assertEqual(q, 2)
1015 self.assertEqual(r, timedelta(seconds=30))
1016
1017 t = timedelta(minutes=-2, seconds=30)
1018 q, r = divmod(t, minute)
1019 self.assertEqual(q, -2)
1020 self.assertEqual(r, timedelta(seconds=30))
1021
1022 zerotd = timedelta(0)
1023 self.assertRaises(ZeroDivisionError, divmod, t, zerotd)
1024
1025 self.assertRaises(TypeError, divmod, t, 10)
1026
1027 def test_issue31293(self):
1028 # The interpreter shouldn't crash in case a timedelta is divided or

Callers

nothing calls this directly

Calls 4

timedeltaClass · 0.90
divmodFunction · 0.50
assertEqualMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected