# Path: src/analyzer/lexicon/reader.py
# def _whitespace_trimmed(line: str) -> str:
# def _empty(line: str) -> bool:
# def _split(line: str) -> List[str]:
# def read_lexicon_entries(path: str) -> Dict[int, _LexiconEntry]:
#   def _index_and_entry(index: int, line: str) -> Tuple[int, _LexiconEntry]:


import collections
import os
from src.analyzer.lexicon import reader
from absl.testing import absltest
from absl.testing import parameterized
                      "features": "+[ComplementType=CGen]",
                      "is_compound": "FALSE",
                  }),
              )),
      },
      {
          "testcase_name": "InvalidLexiconWithOnlyHeader",
          "basename": "invalid_only_header",
          "expected": collections.OrderedDict(),
      },
  ])
  def test_success(self, basename, expected):
    path = os.path.join(_TESTDATA_DIR, f"{basename}.tsv")
    actual = reader.read_lexicon_entries(path)
    self.assertDictEqual(expected, actual)

  @parameterized.named_parameters([
      {
          "testcase_name": "InvalidPath",
          "path": os.path.join(_TESTDATA_DIR, "invalid_path.tsv"),
          "error": IOError,
      },
      {
          "testcase_name": "EmptyPath",
          "path": "",
          "error": IOError,
      },
  ])
  def test_raises_exception(self, path, error):
    with self.assertRaises(error):

# Path: src/analyzer/lexicon/reader.py
# def _whitespace_trimmed(line: str) -> str:
# def _empty(line: str) -> bool:
# def _split(line: str) -> List[str]:
# def read_lexicon_entries(path: str) -> Dict[int, _LexiconEntry]:
#   def _index_and_entry(index: int, line: str) -> Tuple[int, _LexiconEntry]:


# Path: src/analyzer/lexicon/reader_test.py
import collections
import os
from src.analyzer.lexicon import reader
from absl.testing import absltest
from absl.testing import parameterized

                      "features": "+[ComplementType=CGen]",
                      "is_compound": "FALSE",
                  }),
              )),
      },
      {
          "testcase_name": "InvalidLexiconWithOnlyHeader",
          "basename": "invalid_only_header",
          "expected": collections.OrderedDict(),
      },
  ])
  def test_success(self, basename, expected):
    path = os.path.join(_TESTDATA_DIR, f"{basename}.tsv")
    actual = reader.read_lexicon_entries(path)
    self.assertDictEqual(expected, actual)

  @parameterized.named_parameters([
      {
          "testcase_name": "InvalidPath",
          "path": os.path.join(_TESTDATA_DIR, "invalid_path.tsv"),
          "error": IOError,
      },
      {
          "testcase_name": "EmptyPath",
          "path": "",
          "error": IOError,
      },
  ])
  def test_raises_exception(self, path, error):
    with self.assertRaises(error):

      reader.read_lexicon_entries(path)