Permalink
Browse files

InfoExtractor: Add spec_references field

Adds a class attribute named spec_references which
contains links to the issues/documentations for
relevant specs of supported files.

Related to #126
  • Loading branch information...
satwikkansal committed Jun 25, 2017
1 parent 28fa9e8 commit 1d1690149a4a66625580088de4520ca4d9ce02e2
Showing with 15 additions and 0 deletions.
  1. +3 −0 coala_quickstart/info_extraction/InfoExtractor.py
  2. +12 −0 tests/info_extraction/InfoExtractorTest.py
@@ -8,6 +8,9 @@ class InfoExtractor:
# tuple of file globs supported by the extractor.
supported_file_globs = tuple()
# Links to the issues/documentations for relevant specs of supported files.
spec_references = []
# tuple of ``Info`` classes that can be extracted.
supported_info_kinds = (Info,)
@@ -18,6 +18,7 @@ class AnotherDummyInfo(Info):
description = 'Another such information.'
class DummyInfoExtractor(InfoExtractor):
spec_references = ['some/dummy/link', 'another/dummy/link']
def parse_file(self, fname, file_content):
return file_content
@@ -134,6 +135,7 @@ def test_multiple_target_globs(self):
extracted_info[tf]['DummyInfo'][0].extractor,
InfoExtractor)
def test_multiple_information(self):
target_filenames = ['target_file_1', ]
@@ -266,3 +268,13 @@ def test_supported_info_kinds(self):
"information kinds of WrongSupportedInfoExtractor")):
uut.extract_information()
def test_spec_references_filed(self):
uut = self.DummyInfoExtractor
self.assertEqual(len(uut.spec_references), 2)
self.assertEqual(
uut.spec_references,
['some/dummy/link', 'another/dummy/link'])
uut = self.DummyMultiInfoExtractor
self.assertEqual(uut.spec_references, [])

0 comments on commit 1d16901

Please sign in to comment.