Exemplo n.º 1
0
    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)
Exemplo n.º 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