Exemplo n.º 1
0
 def test_random_regenerated_on_pid_change(self):
     # Test that change of pid triggers new random number generation.
     random_original = ObjectId._random()
     ObjectId._pid += 1
     random_new = ObjectId._random()
     self.assertNotEqual(random_original, random_new)
 def test_random_regenerated_on_pid_change(self):
     # Test that change of pid triggers new random number generation.
     random_original = ObjectId._random()
     ObjectId._pid += 1
     random_new = ObjectId._random()
     self.assertNotEqual(random_original, random_new)
Exemplo n.º 3
0
def oid_generated_on_process(oid):
    """Makes a determination as to whether the given ObjectId was generated
    by the current process, based on the 5-byte random number in the ObjectId.
    """
    return ObjectId._random() == oid.binary[4:9]
Exemplo n.º 4
0
def oid_generated_on_process(oid):
    """Makes a determination as to whether the given ObjectId was generated
    by the current process, based on the 5-byte random number in the ObjectId.
    """
    return ObjectId._random() == oid.binary[4:9]