# Path: sampletester/inputs.py
# def untyped_yaml_resolver(unknown_doc: parser.Document) -> str :
# def index_docs(*file_patterns: str) -> parser.IndexedDocs:
#   def log_files(indexed_files):
# def create_indexed_docs(*all_paths: Set[str]) -> parser.IndexedDocs:
# def get_globbed(*file_patterns: str) -> Set[str]:
# 
# Path: sampletester/sample_manifest.py
# SCHEMA = parser.SchemaDescriptor('manifest')
# RESERVED_SYMBOL_PREFIX = '@'
# IMPLICIT_TAG_SOURCE = '{}manifest_source'.format(RESERVED_SYMBOL_PREFIX)
# IMPLICIT_TAG_DIR = '{}manifest_dir'.format(RESERVED_SYMBOL_PREFIX)
# class Manifest:
# class ManifestSyntaxError(Exception):
# class CycleError(Exception):
# class Inclusions:
# class ItemNotUniqueError(Exception):
# class ReadManifestError(Exception):
#   def __init__(self, *indices: str):
#   def set_indices(self, *indices: str):
#   def from_docs(self, indexed_docs: parser.IndexedDocs):
#   def read_sources(self, sources):
#   def string(self):
#   def index(self):
#   def index_source_v1(self, input, implicit_tags):
#   def index_source_v2(self, input, implicit_tags):
#   def index_source_v3(self, input, implicit_tags):
#   def _index_elements(self, all_elements):
#   def get_all_elements(self):
#   def _get_element(self, tags, idx_num):
#   def get_keys(self, *specified_keys):
#   def get(self, *keys, **filters):
#   def get_one(self, *keys, **filters):
# def get_elements_v3(input):
# def get_flattened_elements_v1_v2(input):
# def resolve_inclusions(all_elements):
# def resolve_element_inclusions(element):
# def resolve_tag_inclusion (element, tag_name, history,
#                            resolved, original_element, original_tag):
#   def __init__(self, parts):
#   def resolve(self, values):
#   def determine(value, element, tag_name):
# def create_implicit_tags(source='', dir=''):
# def extend_all_with(src, dst):
# def get_or_create(d, key, empty_value):
# def from_indexed_docs(indexed_docs: parser.IndexedDocs):
# def check_tag_names(src):


import os
import unittest
from sampletester import inputs
from sampletester import sample_manifest

_ABS_FILE = os.path.abspath(__file__)
_ABS_DIR = os.path.dirname(_ABS_FILE)


class TestManifestV1V2(unittest.TestCase):

  def test_read_no_version(self):
    manifest_source, _ = self.get_manifest_source()
    manifest_source[1].pop(sample_manifest.Manifest.VERSION_KEY_v1v2)
    manifest = sample_manifest.Manifest('language', 'sample')
    with self.assertRaises(Exception):
      manifest.read_sources([manifest_source])

  def test_read_invalid_version(self):
    manifest_source, _ = self.get_manifest_source()
    manifest_source[1][sample_manifest.Manifest.VERSION_KEY_v1v2] = 'foo'
    manifest = sample_manifest.Manifest('language', 'sample')
    with self.assertRaises(Exception):
      manifest.read_sources([manifest_source])

  def test_get_(self):
    self.do_test_get_(self.get_manifest_source)

  def test_get_with_implicits(self):
    self.do_test_get_(self.get_manifest_source_with_implicits)

  def do_test_get_(self, getter):
    manifest_source, (expect_alice, expect_bob, expect_carol, expect_dan) = getter()


# Path: sampletester/inputs.py
# def untyped_yaml_resolver(unknown_doc: parser.Document) -> str :
# def index_docs(*file_patterns: str) -> parser.IndexedDocs:
#   def log_files(indexed_files):
# def create_indexed_docs(*all_paths: Set[str]) -> parser.IndexedDocs:
# def get_globbed(*file_patterns: str) -> Set[str]:
# 
# Path: sampletester/sample_manifest.py
# SCHEMA = parser.SchemaDescriptor('manifest')
# RESERVED_SYMBOL_PREFIX = '@'
# IMPLICIT_TAG_SOURCE = '{}manifest_source'.format(RESERVED_SYMBOL_PREFIX)
# IMPLICIT_TAG_DIR = '{}manifest_dir'.format(RESERVED_SYMBOL_PREFIX)
# class Manifest:
# class ManifestSyntaxError(Exception):
# class CycleError(Exception):
# class Inclusions:
# class ItemNotUniqueError(Exception):
# class ReadManifestError(Exception):
#   def __init__(self, *indices: str):
#   def set_indices(self, *indices: str):
#   def from_docs(self, indexed_docs: parser.IndexedDocs):
#   def read_sources(self, sources):
#   def string(self):
#   def index(self):
#   def index_source_v1(self, input, implicit_tags):
#   def index_source_v2(self, input, implicit_tags):
#   def index_source_v3(self, input, implicit_tags):
#   def _index_elements(self, all_elements):
#   def get_all_elements(self):
#   def _get_element(self, tags, idx_num):
#   def get_keys(self, *specified_keys):
#   def get(self, *keys, **filters):
#   def get_one(self, *keys, **filters):
# def get_elements_v3(input):
# def get_flattened_elements_v1_v2(input):
# def resolve_inclusions(all_elements):
# def resolve_element_inclusions(element):
# def resolve_tag_inclusion (element, tag_name, history,
#                            resolved, original_element, original_tag):
#   def __init__(self, parts):
#   def resolve(self, values):
#   def determine(value, element, tag_name):
# def create_implicit_tags(source='', dir=''):
# def extend_all_with(src, dst):
# def get_or_create(d, key, empty_value):
# def from_indexed_docs(indexed_docs: parser.IndexedDocs):
# def check_tag_names(src):


# Path: tests/sample_manifest_v1v2_test.py
import os
import unittest
from sampletester import inputs
from sampletester import sample_manifest


_ABS_FILE = os.path.abspath(__file__)
_ABS_DIR = os.path.dirname(_ABS_FILE)


class TestManifestV1V2(unittest.TestCase):

  def test_read_no_version(self):
    manifest_source, _ = self.get_manifest_source()
    manifest_source[1].pop(sample_manifest.Manifest.VERSION_KEY_v1v2)
    manifest = sample_manifest.Manifest('language', 'sample')
    with self.assertRaises(Exception):
      manifest.read_sources([manifest_source])

  def test_read_invalid_version(self):
    manifest_source, _ = self.get_manifest_source()
    manifest_source[1][sample_manifest.Manifest.VERSION_KEY_v1v2] = 'foo'
    manifest = sample_manifest.Manifest('language', 'sample')
    with self.assertRaises(Exception):
      manifest.read_sources([manifest_source])

  def test_get_(self):
    self.do_test_get_(self.get_manifest_source)

  def test_get_with_implicits(self):
    self.do_test_get_(self.get_manifest_source_with_implicits)

  def do_test_get_(self, getter):
    manifest_source, (expect_alice, expect_bob, expect_carol, expect_dan) = getter()


    manifest = sample_manifest.Manifest('language', 'sample')