File: utils.py

package info (click to toggle)
breadability 0.1.20-3
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 316 kB
  • ctags: 282
  • sloc: python: 1,713; makefile: 18
file content (23 lines) | stat: -rw-r--r-- 647 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# -*- coding: utf8 -*-

from __future__ import absolute_import
from __future__ import division, print_function, unicode_literals

from os.path import abspath, dirname, join


TEST_DIR = abspath(dirname(__file__))


def load_snippet(file_name):
    """Helper to fetch in the content of a test snippet."""
    file_path = join(TEST_DIR, "data/snippets", file_name)
    with open(file_path, "rb") as file:
        return file.read()


def load_article(file_name):
    """Helper to fetch in the content of a test article."""
    file_path = join(TEST_DIR, "data/articles", file_name)
    with open(file_path, "rb") as file:
        return file.read()