Exemplo n.º 1
0
 def getRawHtml(self):
     test, suite, module, cls, func = self.id().split('.')
     path = os.path.join(os.path.dirname(CURRENT_PATH), "data", suite,
                         module.partition('test_')[2], "%s.html" % func)
     path = os.path.abspath(path)
     content = FileHelper.loadResourceFile(path)
     return content
Exemplo n.º 2
0
 def load_customesite_mapping(self):
     # TODO
     path = os.path.join('images', 'known-image-css.txt')
     data_file = FileHelper.loadResourceFile(path)
     lines = data_file.splitlines()
     for line in lines:
         domain, css = line.split('^')
         self.custom_site_mapping.update({domain: css})
Exemplo n.º 3
0
 def __init__(self, language='en'):
     if language not in self._cached_stop_words:
         path = os.path.join('text', 'stopwords-%s.txt' % language)
         try:
             content = FileHelper.loadResourceFile(path)
             word_list = content.splitlines()
         except IOError:
             word_list = []
         self._cached_stop_words[language] = set(word_list)
     self._stop_words = self._cached_stop_words[language]
Exemplo n.º 4
0
 def __init__(self, language='en'):
     # TODO replace 'x' with class
     # to generate dynamic path for file to load
     if not language in self._cached_stop_words:
         path = os.path.join('text', 'stopwords-%s.txt' % language)
         try:
             content = FileHelper.loadResourceFile(path)
             word_list = content.splitlines()
         except IOError:
             word_list = []
         self._cached_stop_words[language] = set(word_list)
     self.STOP_WORDS = self._cached_stop_words[language]
Exemplo n.º 5
0
    def loadData(self):
        """\

        """
        full_id = self.id().split('.')

        test, module, cls, func = full_id
        path = os.path.join(
            os.path.dirname(CURRENT_PATH),
            'tests',
            "data",
            # suite,
            module.partition('test_')[2],
            "%s.json" % func)
        path = os.path.abspath(path)
        content = FileHelper.loadResourceFile(path)
        self.data = json.loads(content)
Exemplo n.º 6
0
 def loadHtml(self):
     test, module, cls, func = self.id().split('.')
     path = os.path.join(os.path.dirname(CURRENT_PATH), 'tests', "data",
                         module.partition('test_')[2], "%s.html" % func)
     path = os.path.abspath(path)
     self.html = FileHelper.loadResourceFile(path)
Exemplo n.º 7
0
 def get_html(self, filename):
     path = os.path.join(CURRENT_PATH, 'data', filename)
     path = os.path.abspath(path)
     return FileHelper.loadResourceFile(path)