# Path: fedjax/datasets/cifar100.py
# SPLITS = ('train', 'test')
# _TFF_SQLITE_COMPRESSED_HEXDIGEST = '23d3916c9caa33395737ee560cc7cb77bbd05fc7b73647ee7be3a7e764172939'
# _TFF_SQLITE_COMPRESSED_NUM_BYTES = 153019920
# _FEDJAX_SQLITE_HEXDIGEST = {
#     'train': 'a4dc2f4ac4c9b6e7bd5234a1b568389384c00c903dcd34001c3cf50a4a81c713',
#     'test': '74416c6ee8f41b1086f0e0e3c5289ac6df5a641100df48e8b583411a55de891f'
# }
# _FEDJAX_SQLITE_NUM_BYTES = {'train': 140521472, 'test': 28135424}
# CIFAR100_PIXELS_MEAN = np.array([0.4914, 0.4822, 0.4465], dtype=np.float32)
# CIFAR100_PIXELS_INVERSE_STDDEV = (
#     1 / np.array([0.2023, 0.1994, 0.2010], dtype=np.float32))
# def cite():
# def _parse_tf_examples(vs: List[bytes]) -> client_datasets.Examples:
# def load_split(split: str,
#                mode: str = 'sqlite',
#                cache_dir: Optional[str] = None) -> federated_data.FederatedData:
# def load_data(
#     mode: str = 'sqlite',
#     cache_dir: Optional[str] = None
# ) -> Tuple[federated_data.FederatedData, federated_data.FederatedData]:
# def preprocess_client(
#     client_id: federated_data.ClientId,
#     examples: client_datasets.Examples) -> client_datasets.Examples:
# def preprocess_image(image: np.ndarray, is_train: bool) -> np.ndarray:
# def preprocess_batch(examples: client_datasets.Examples,
#                      is_train: bool) -> client_datasets.Examples:


from absl.testing import absltest
from fedjax.datasets import cifar100
import numpy as np
import numpy.testing as npt
# Copyright 2021 Google LLC
#
# 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.datasets.cifar100.

This file only tests preprocessing functions.
"""



class Cifar100Test(absltest.TestCase):

  def test_preprocess_client(self):
    image = np.random.randint(256, size=[4, 32, 32, 3]).astype(np.uint8)
    coarse_label = np.random.randint(20, size=[4]).astype(np.int64)
    label = np.random.randint(100, size=[4]).astype(np.int64)
    npt.assert_equal(

# Path: fedjax/datasets/cifar100.py
# SPLITS = ('train', 'test')
# _TFF_SQLITE_COMPRESSED_HEXDIGEST = '23d3916c9caa33395737ee560cc7cb77bbd05fc7b73647ee7be3a7e764172939'
# _TFF_SQLITE_COMPRESSED_NUM_BYTES = 153019920
# _FEDJAX_SQLITE_HEXDIGEST = {
#     'train': 'a4dc2f4ac4c9b6e7bd5234a1b568389384c00c903dcd34001c3cf50a4a81c713',
#     'test': '74416c6ee8f41b1086f0e0e3c5289ac6df5a641100df48e8b583411a55de891f'
# }
# _FEDJAX_SQLITE_NUM_BYTES = {'train': 140521472, 'test': 28135424}
# CIFAR100_PIXELS_MEAN = np.array([0.4914, 0.4822, 0.4465], dtype=np.float32)
# CIFAR100_PIXELS_INVERSE_STDDEV = (
#     1 / np.array([0.2023, 0.1994, 0.2010], dtype=np.float32))
# def cite():
# def _parse_tf_examples(vs: List[bytes]) -> client_datasets.Examples:
# def load_split(split: str,
#                mode: str = 'sqlite',
#                cache_dir: Optional[str] = None) -> federated_data.FederatedData:
# def load_data(
#     mode: str = 'sqlite',
#     cache_dir: Optional[str] = None
# ) -> Tuple[federated_data.FederatedData, federated_data.FederatedData]:
# def preprocess_client(
#     client_id: federated_data.ClientId,
#     examples: client_datasets.Examples) -> client_datasets.Examples:
# def preprocess_image(image: np.ndarray, is_train: bool) -> np.ndarray:
# def preprocess_batch(examples: client_datasets.Examples,
#                      is_train: bool) -> client_datasets.Examples:


# Path: fedjax/datasets/cifar100_test.py
from absl.testing import absltest
from fedjax.datasets import cifar100
import numpy as np
import numpy.testing as npt

# Copyright 2021 Google LLC
#
# 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.datasets.cifar100.

This file only tests preprocessing functions.
"""



class Cifar100Test(absltest.TestCase):

  def test_preprocess_client(self):
    image = np.random.randint(256, size=[4, 32, 32, 3]).astype(np.uint8)
    coarse_label = np.random.randint(20, size=[4]).astype(np.int64)
    label = np.random.randint(100, size=[4]).astype(np.int64)
    npt.assert_equal(

        cifar100.preprocess_client(None, {