# Path: fedjax/training/checkpoint.py
# _CHECKPOINT_PREFIX = 'checkpoint_'
# def _get_checkpoint_paths(base_path: str) -> List[str]:
#   def sort_key(path):
# def load_latest_checkpoint(root_dir: str) -> Optional[Tuple[Any, int]]:
# def save_checkpoint(root_dir: str,
#                     state: Any,
#                     round_num: int = 0,
#                     keep: int = 1):


import os
import jax.numpy as jnp
import numpy.testing as npt
from absl.testing import absltest
from fedjax.training import checkpoint
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for fedjax.training.checkpoint."""





class CheckpointTest(absltest.TestCase):

  def setUp(self):
    super().setUp()
    self._root_dir = self.create_tempdir()

  def _write_file(self, basename):
    path = os.path.join(self._root_dir, basename)
    with open(path, 'w') as f:
      f.write(basename)

  def test_save_checkpoint(self):

# Path: fedjax/training/checkpoint.py
# _CHECKPOINT_PREFIX = 'checkpoint_'
# def _get_checkpoint_paths(base_path: str) -> List[str]:
#   def sort_key(path):
# def load_latest_checkpoint(root_dir: str) -> Optional[Tuple[Any, int]]:
# def save_checkpoint(root_dir: str,
#                     state: Any,
#                     round_num: int = 0,
#                     keep: int = 1):


# Path: fedjax/training/checkpoint_test.py
import os
import jax.numpy as jnp
import numpy.testing as npt
from absl.testing import absltest
from fedjax.training import checkpoint

#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for fedjax.training.checkpoint."""





class CheckpointTest(absltest.TestCase):

  def setUp(self):
    super().setUp()
    self._root_dir = self.create_tempdir()

  def _write_file(self, basename):
    path = os.path.join(self._root_dir, basename)
    with open(path, 'w') as f:
      f.write(basename)

  def test_save_checkpoint(self):

    checkpoint.save_checkpoint(self._root_dir, {'w': jnp.ones(10)})