예제 #1
0
파일: loader.py 프로젝트: dcolish/braces
    def read(self, path, encoding=None):
        """
        Read the template at the given path, and return it as a unicode string.

        """
        b = common.read(path)

        if encoding is None:
            encoding = self.file_encoding

        return self.unicode(b, encoding)
예제 #2
0
def _read_spec_tests(path):
    """
    Return a list of unittest.TestCase instances.

    """
    b = common.read(path)
    u = unicode(b, encoding=FILE_ENCODING)
    spec_data = parse(u)
    tests = spec_data['tests']

    cases = []
    for data in tests:
        case = _deserialize_spec_test(data, path)
        cases.append(case)

    return cases