def test_create_memory_state_backend(self): self.assertIsNotNone(MemoryStateBackend("file://var/checkpoints/")) self.assertIsNotNone(MemoryStateBackend("file://var/checkpoints/", "file://var/savepoints/")) self.assertIsNotNone(MemoryStateBackend( "file://var/checkpoints/", "file://var/savepoints/", 10000000)) self.assertIsNotNone(MemoryStateBackend( "file://var/checkpoints/", "file://var/savepoints/", 10000000, True)) self.assertIsNotNone(MemoryStateBackend( "file://var/checkpoints/", "file://var/savepoints/", 10000000, False))
def test_is_using_asynchronous_snapshots(self): state_backend = MemoryStateBackend() self.assertTrue(state_backend.is_using_asynchronous_snapshots()) state_backend = MemoryStateBackend(using_asynchronous_snapshots=True) self.assertTrue(state_backend.is_using_asynchronous_snapshots()) state_backend = MemoryStateBackend(using_asynchronous_snapshots=False) self.assertFalse(state_backend.is_using_asynchronous_snapshots())
def test_get_max_state_size(self): state_backend = MemoryStateBackend() self.assertEqual(state_backend.get_max_state_size(), MemoryStateBackend.DEFAULT_MAX_STATE_SIZE) state_backend = MemoryStateBackend(max_state_size=50000) self.assertEqual(state_backend.get_max_state_size(), 50000)