(self)
| 1463 | self.theclass.fromtimestamp(None) |
| 1464 | |
| 1465 | def test_today(self): |
| 1466 | import time |
| 1467 | |
| 1468 | # We claim that today() is like fromtimestamp(time.time()), so |
| 1469 | # prove it. |
| 1470 | for dummy in range(3): |
| 1471 | today = self.theclass.today() |
| 1472 | ts = time.time() |
| 1473 | todayagain = self.theclass.fromtimestamp(ts) |
| 1474 | if today == todayagain: |
| 1475 | break |
| 1476 | # There are several legit reasons that could fail: |
| 1477 | # 1. It recently became midnight, between the today() and the |
| 1478 | # time() calls. |
| 1479 | # 2. The platform time() has such fine resolution that we'll |
| 1480 | # never get the same value twice. |
| 1481 | # 3. The platform time() has poor resolution, and we just |
| 1482 | # happened to call today() right before a resolution quantum |
| 1483 | # boundary. |
| 1484 | # 4. The system clock got fiddled between calls. |
| 1485 | # In any case, wait a little while and try again. |
| 1486 | time.sleep(0.1) |
| 1487 | |
| 1488 | # It worked or it didn't. If it didn't, assume it's reason #2, and |
| 1489 | # let the test pass if they're within half a second of each other. |
| 1490 | if today != todayagain: |
| 1491 | self.assertAlmostEqual(todayagain, today, |
| 1492 | delta=timedelta(seconds=0.5)) |
| 1493 | |
| 1494 | def test_weekday(self): |
| 1495 | for i in range(7): |
nothing calls this directly
no test coverage detected