@@ -53,24 +53,26 @@ def test_uuid_from_time(self):
5353 seq = 0x2aa5
5454 node = uuid .getnode ()
5555 u = util .uuid_from_time (t , node , seq )
56- self .assertEqual (util .unix_time_from_uuid1 (u ), t )
56+ # using AlmostEqual because time precision is different for
57+ # some platforms
58+ self .assertAlmostEqual (util .unix_time_from_uuid1 (u ), t , 4 )
5759 self .assertEqual (u .node , node )
5860 self .assertEqual (u .clock_seq , seq )
5961
6062 # random node
6163 u1 = util .uuid_from_time (t , clock_seq = seq )
6264 u2 = util .uuid_from_time (t , clock_seq = seq )
63- self .assertEqual (util .unix_time_from_uuid1 (u1 ), t )
64- self .assertEqual (util .unix_time_from_uuid1 (u2 ), t )
65+ self .assertAlmostEqual (util .unix_time_from_uuid1 (u1 ), t , 4 )
66+ self .assertAlmostEqual (util .unix_time_from_uuid1 (u2 ), t , 4 )
6567 self .assertEqual (u .clock_seq , seq )
6668 # not impossible, but we shouldn't get the same value twice
6769 self .assertNotEqual (u1 .node , u2 .node )
6870
6971 # random seq
7072 u1 = util .uuid_from_time (t , node = node )
7173 u2 = util .uuid_from_time (t , node = node )
72- self .assertEqual (util .unix_time_from_uuid1 (u1 ), t )
73- self .assertEqual (util .unix_time_from_uuid1 (u2 ), t )
74+ self .assertAlmostEqual (util .unix_time_from_uuid1 (u1 ), t , 4 )
75+ self .assertAlmostEqual (util .unix_time_from_uuid1 (u2 ), t , 4 )
7476 self .assertEqual (u .node , node )
7577 # not impossible, but we shouldn't get the same value twice
7678 self .assertNotEqual (u1 .clock_seq , u2 .clock_seq )
@@ -86,7 +88,7 @@ def test_uuid_from_time(self):
8688 # construct from datetime
8789 dt = util .datetime_from_timestamp (t )
8890 u = util .uuid_from_time (dt , node , seq )
89- self .assertEqual (util .unix_time_from_uuid1 (u ), t )
91+ self .assertAlmostEqual (util .unix_time_from_uuid1 (u ), t , 4 )
9092 self .assertEqual (u .node , node )
9193 self .assertEqual (u .clock_seq , seq )
9294
0 commit comments