Skip to content

Move to full MyCapytain DTS compliance #152

@sonofmun

Description

@sonofmun

This issue is to track what needs to be changed to make HookTest compliant with the new MyCapytain guidelines: https://github.com/Capitains/guidelines. The user will be able to choose whether to use these new guidelines or the old guidelines through the guidelines parameter, i.e., choosing 3.epidoc or 3.tei instead of 2.epidoc or 2.tei.
Changes that I see right now need to be made:

  • HookTest should use the new __capitains__.xml files instead of __cts__.xml
    • This will require a change to the finder, probably with a new DTSFinder sub-class (see
      class DefaultFinder(object):
      """ Finder are object used in Test to retrieve the target files of the tests
      """
      def __init__(self, **options):
      pass
      def find(self, directory):
      """ Return object to find
      :param directory: Root Directory to search in
      :returns: Path of xml text files, Path of __cts__.xml files
      :rtype: (list, list)
      """
      data = glob.glob(os.path.join(directory, "data/*/*/*.xml")) + glob.glob(os.path.join(directory, "data/*/*.xml"))
      files, cts = [f for f in data if "__cts__.xml" not in f], [f for f in data if "__cts__.xml" in f]
      # For unit testing and human readable progression
      cts.sort()
      files.sort()
      return files, cts
      class FilterFinder(DefaultFinder):
      """ FilterFinder provide a filtering capacity to DefaultFinder.
      It takes an include option which takes the form of the work urn (*ie.* in urn:cts:latinLit:phi1294.phi002.perseus-lat2 \
      this would be phi1294.phi002.perseus-lat2, cut at any of the points : phi1294, phi1294.phi002, phi1294.phi002.perseus-lat2)
      :param include: Representation of the work urn component (might be from one member down to the version member)
      :type include: str
      """
      def __init__(self, include, **options):
      self.include = include.split(".")
      def find(self, directory):
      """ Return object to find
      :param directory: Root Directory to search in
      :returns: Path of xml text files, Path of __cts__.xml files
      :rtype: (list, list)
      """
      textgroup, work, version = "*", "*", "*.*.*",
      if len(self.include) == 3:
      version = ".".join(self.include)
      if len(self.include) >= 2:
      work = self.include[1]
      if len(self.include) >= 1:
      textgroup = self.include[0]
      cts = glob.glob(os.path.join(directory, "data/{textgroup}/__cts__.xml".format(
      textgroup=textgroup
      ))) + \
      glob.glob(os.path.join(directory, "data/{textgroup}/{work}/__cts__.xml".format(
      textgroup=textgroup, work=work
      )))
      files = glob.glob(os.path.join(directory, "data/{textgroup}/{work}/{version}.xml".format(
      textgroup=textgroup, work=work, version=version
      )))
      # For unit testing and human readable progression
      cts.sort()
      files.sort()
      return files, cts
      )
    • It will also require code to correctly test these files, probably as a DTSMetadata_TestUnit sub-class of TESTUnit
  • Compatible with new text guidelines
    • According to the guidelines, the only changes here are in the refsDecl. Here we need to:
    • Check the @n and @xml:base attributes on the refsDecl element
    • Check the @corresp attribute on cRefPattern to make sure it exists and there are no duplicates. Perhaps also that every level has a cRefPattern, i.e., that the number of cRefPattern nodes equals the max depth of a citation in the text.
    • Check the @matchPattern attributes on cRefPattern to make sure that:
      • they are unique
      • that the number of dots in the @matchPattern == @corresp - 1. This should help to avoid the error of using dot to match all and that the @matchPattern is for a different citation level than the one being represented.

What have I forgotten here?

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions