# Path: ml_collections/config_flags/config_path.py
# _AST_SPLIT_CONFIG_PATH = {
#     ast.Attribute: lambda n: (*_split_node(n.value), n.attr),
#     ast.Index: lambda i: _split_node(i.value),
#     ast.Name: lambda n: (n.id,),
#     ast.Slice: lambda i: slice(*map(_split_node, (i.lower, i.upper, i.step))),
#     ast.Subscript: lambda n: (*_split_node(n.value), _split_node(n.slice)),
#     type(None): lambda n: None
# }
# def _split_node(node):
# def split(config_path: str) -> Tuple[Any]:
# def _get_item_or_attribute(config, field):
# def _get_holder_field(config_path: str, config: Any) -> Tuple[Any, str]:
# def get_value(config_path: str, config: Any):
# def get_type(config_path: str, config: Any):
# def set_value(config_path: str, config: Any, value: Any):
# 
# Path: ml_collections/config_flags/tests/fieldreference_config.py
# def get_config():
# 
# Path: ml_collections/config_flags/tests/mock_config.py
# class TestConfig(object):
#   def __init__(self):
#   def readonly_field(self):
#   def __repr__(self):
# def get_config():


from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config
# Copyright 2022 The ML Collections Authors.
#
# 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 config_path."""



class ConfigPathTest(parameterized.TestCase):

  def test_list_extra_index(self):
    """Tries to index a non-indexable list element."""

    test_config = mock_config.get_config()
    with self.assertRaises(IndexError):

# Path: ml_collections/config_flags/config_path.py
# _AST_SPLIT_CONFIG_PATH = {
#     ast.Attribute: lambda n: (*_split_node(n.value), n.attr),
#     ast.Index: lambda i: _split_node(i.value),
#     ast.Name: lambda n: (n.id,),
#     ast.Slice: lambda i: slice(*map(_split_node, (i.lower, i.upper, i.step))),
#     ast.Subscript: lambda n: (*_split_node(n.value), _split_node(n.slice)),
#     type(None): lambda n: None
# }
# def _split_node(node):
# def split(config_path: str) -> Tuple[Any]:
# def _get_item_or_attribute(config, field):
# def _get_holder_field(config_path: str, config: Any) -> Tuple[Any, str]:
# def get_value(config_path: str, config: Any):
# def get_type(config_path: str, config: Any):
# def set_value(config_path: str, config: Any, value: Any):
# 
# Path: ml_collections/config_flags/tests/fieldreference_config.py
# def get_config():
# 
# Path: ml_collections/config_flags/tests/mock_config.py
# class TestConfig(object):
#   def __init__(self):
#   def readonly_field(self):
#   def __repr__(self):
# def get_config():


# Path: ml_collections/config_flags/tests/config_path_test.py
from absl.testing import absltest
from absl.testing import parameterized
from ml_collections.config_flags import config_path
from ml_collections.config_flags.tests import fieldreference_config
from ml_collections.config_flags.tests import mock_config

# Copyright 2022 The ML Collections Authors.
#
# 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 config_path."""



class ConfigPathTest(parameterized.TestCase):

  def test_list_extra_index(self):
    """Tries to index a non-indexable list element."""

    test_config = mock_config.get_config()
    with self.assertRaises(IndexError):

      config_path.get_value('dict.list[0][0]', test_config)