()
| 9 | |
| 10 | |
| 11 | def test_chrono_system_clock(): |
| 12 | # Get the time from both c++ and datetime |
| 13 | date0 = datetime.datetime.today() |
| 14 | date1 = m.test_chrono1() |
| 15 | date2 = datetime.datetime.today() |
| 16 | |
| 17 | # The returned value should be a datetime |
| 18 | assert isinstance(date1, datetime.datetime) |
| 19 | |
| 20 | # The numbers should vary by a very small amount (time it took to execute) |
| 21 | diff_python = abs(date2 - date0) |
| 22 | diff = abs(date1 - date2) |
| 23 | |
| 24 | # There should never be a days difference |
| 25 | assert diff.days == 0 |
| 26 | |
| 27 | # Since datetime.datetime.today() calls time.time(), and on some platforms |
| 28 | # that has 1 second accuracy, we compare this way |
| 29 | assert diff.seconds <= diff_python.seconds |
| 30 | |
| 31 | |
| 32 | def test_chrono_system_clock_roundtrip(): |
nothing calls this directly
no test coverage detected