Repository navigation
Expand file tree
/
Copy pathtest_sfdb.py
More file actions
38 lines (30 loc) · 1.47 KB
/
Copy pathtest_sfdb.py
File metadata and controls
38 lines (30 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#
# Copyright (c) nexB Inc. and others. All rights reserved.
# ScanCode is a trademark of nexB Inc.
# SPDX-License-Identifier: Apache-2.0
# See http://www.apache.org/licenses/LICENSE-2.0 for the license text.
# See https://github.com/nexB/scancode-toolkit for support or download.
# See https://aboutcode.org for more information about nexB OSS projects.
#
import os
from commoncode.testcase import FileBasedTesting
from textcode import sfdb
class TestSfdb(FileBasedTesting):
test_data_dir = os.path.join(os.path.dirname(__file__), 'data')
def check_get_text_lines(self, test_file, expected_file):
test_file = self.get_test_loc(test_file)
expected_file = self.get_test_loc(expected_file)
expected = open(expected_file, 'rb').read().splitlines(True)
assert list(sfdb.get_text_lines(test_file)) == expected
def test_get_text_lines_ambro(self):
test_file = 'splinefonts/Ambrosia.sfd'
expected_file = 'splinefonts/Ambrosia.sfd.expected'
self.check_get_text_lines(test_file, expected_file)
def test_get_text_lines_deja(self):
test_file = 'splinefonts/DejaVuSerif.sfd'
expected_file = 'splinefonts/DejaVuSerif.sfd.expected'
self.check_get_text_lines(test_file, expected_file)
def test_get_text_lines_liber(self):
test_file = 'splinefonts/LiberationMono-Italic.sfd'
expected_file = 'splinefonts/LiberationMono-Italic.sfd.expected'
self.check_get_text_lines(test_file, expected_file)