def test_atomic_counter2(self): local.path("counter").delete() afc = AtomicCounterFile.open("counter") self.assertEqual(afc.next(), 0) self.assertEqual(afc.next(), 1) self.assertEqual(afc.next(), 2) self.assertRaises(TypeError, afc.reset, "hello") afc.reset(70) self.assertEqual(afc.next(), 70) self.assertEqual(afc.next(), 71) self.assertEqual(afc.next(), 72) local.path("counter").delete()
def test_atomic_counter2(self): local.path("counter").delete() afc = AtomicCounterFile.open("counter") assert afc.next() == 0 assert afc.next() == 1 assert afc.next() == 2 with pytest.raises(TypeError): afc.reset("hello") afc.reset(70) assert afc.next() == 70 assert afc.next() == 71 assert afc.next() == 72 local.path("counter").delete()