# Path: model_card_toolkit/model_card.py
# class Owner(BaseModelCardField):
# class Version(BaseModelCardField):
# class License(BaseModelCardField):
# class Reference(BaseModelCardField):
# class Citation(BaseModelCardField):
# class ModelDetails(BaseModelCardField):
# class Graphic(BaseModelCardField):
# class GraphicsCollection(BaseModelCardField):
# class SensitiveData(BaseModelCardField):
# class Dataset(BaseModelCardField):
# class KeyVal(BaseModelCardField):
# class ModelParameters(BaseModelCardField):
# class ConfidenceInterval(BaseModelCardField):
# class PerformanceMetric(BaseModelCardField):
# class QuantitativeAnalysis(BaseModelCardField):
# class User(BaseModelCardField):
# class UseCase(BaseModelCardField):
# class Limitation(BaseModelCardField):
# class Tradeoff(BaseModelCardField):
# class Risk(BaseModelCardField):
# class Considerations(BaseModelCardField):
# class ModelCard(BaseModelCardField):
#   def to_json(self) -> str:
#   def from_json(self, json_dict: Dict[str, Any]) -> None:
#   def merge_from_json(self, json: Union[Dict[str, Any], str]) -> None:


import json
import os
import pkgutil
import jsonschema
from absl.testing import absltest
from model_card_toolkit import model_card
from model_card_toolkit.proto import model_card_pb2
from google.protobuf import text_format
# 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 model_card_toolkit.model_card."""




_FULL_PROTO_FILE_NAME = "full.pbtxt"
_FULL_PROTO = pkgutil.get_data(
    "model_card_toolkit",
    os.path.join("template/test", _FULL_PROTO_FILE_NAME))
_FULL_JSON_FILE_PATH = "full.json"
_FULL_JSON = model_card_json_bytestring = pkgutil.get_data(
    "model_card_toolkit",
    os.path.join("template/test", _FULL_JSON_FILE_PATH))


class ModelCardTest(absltest.TestCase):

  def test_copy_from_proto_and_to_proto_with_all_fields(self):
    want_proto = text_format.Parse(_FULL_PROTO, model_card_pb2.ModelCard())

# Path: model_card_toolkit/model_card.py
# class Owner(BaseModelCardField):
# class Version(BaseModelCardField):
# class License(BaseModelCardField):
# class Reference(BaseModelCardField):
# class Citation(BaseModelCardField):
# class ModelDetails(BaseModelCardField):
# class Graphic(BaseModelCardField):
# class GraphicsCollection(BaseModelCardField):
# class SensitiveData(BaseModelCardField):
# class Dataset(BaseModelCardField):
# class KeyVal(BaseModelCardField):
# class ModelParameters(BaseModelCardField):
# class ConfidenceInterval(BaseModelCardField):
# class PerformanceMetric(BaseModelCardField):
# class QuantitativeAnalysis(BaseModelCardField):
# class User(BaseModelCardField):
# class UseCase(BaseModelCardField):
# class Limitation(BaseModelCardField):
# class Tradeoff(BaseModelCardField):
# class Risk(BaseModelCardField):
# class Considerations(BaseModelCardField):
# class ModelCard(BaseModelCardField):
#   def to_json(self) -> str:
#   def from_json(self, json_dict: Dict[str, Any]) -> None:
#   def merge_from_json(self, json: Union[Dict[str, Any], str]) -> None:


# Path: model_card_toolkit/model_card_test.py
import json
import os
import pkgutil
import jsonschema
from absl.testing import absltest
from model_card_toolkit import model_card
from model_card_toolkit.proto import model_card_pb2
from google.protobuf import text_format

# 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 model_card_toolkit.model_card."""




_FULL_PROTO_FILE_NAME = "full.pbtxt"
_FULL_PROTO = pkgutil.get_data(
    "model_card_toolkit",
    os.path.join("template/test", _FULL_PROTO_FILE_NAME))
_FULL_JSON_FILE_PATH = "full.json"
_FULL_JSON = model_card_json_bytestring = pkgutil.get_data(
    "model_card_toolkit",
    os.path.join("template/test", _FULL_JSON_FILE_PATH))


class ModelCardTest(absltest.TestCase):

  def test_copy_from_proto_and_to_proto_with_all_fields(self):
    want_proto = text_format.Parse(_FULL_PROTO, model_card_pb2.ModelCard())

    model_card_py = model_card.ModelCard()