Skip to content

Instantly share code, notes, and snippets.

@alistairncoles
Created June 19, 2014 14:01
Show Gist options
  • Save alistairncoles/e9e95dc34076ea32b0c6 to your computer and use it in GitHub Desktop.
Save alistairncoles/e9e95dc34076ea32b0c6 to your computer and use it in GitHub Desktop.
diff --git a/test/unit/common/test_utils.py b/test/unit/common/test_utils.py
index 18a12d8..4d874c4 100644
--- a/test/unit/common/test_utils.py
+++ b/test/unit/common/test_utils.py
@@ -228,6 +228,29 @@ class TestTimestamp(unittest.TestCase):
)
for value in test_values:
self.assertEqual(utils.Timestamp(value).isoformat, expected)
+ expected = '1970-01-01T00:00:00.000000'
+ test_values = (
+ '0',
+ '0000000000.00000',
+ '0000000000.00000_ffffffffffff',
+ 0,
+ 0.0,
+ )
+ for value in test_values:
+ self.assertEqual(utils.Timestamp(value).isoformat, expected)
+
+ def test_not_equal(self):
+ ts = '1402436408.91203_0000000000000001'
+ test_values = (
+ utils.Timestamp('1402436408.91203_0000000000000002'),
+ utils.Timestamp('1402436408.91203'),
+ utils.Timestamp(1402436408.91203),
+ utils.Timestamp(1402436408.91204),
+ utils.Timestamp(1402436408.91203, offset=0),
+ utils.Timestamp(1402436408.91203, offset=2),
+ )
+ for value in test_values:
+ self.assertTrue(value != ts)
def test_no_force_internal_no_offset(self):
"""Test that internal is the same as normal with no offset"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment