-
Notifications
You must be signed in to change notification settings - Fork 1
/
test_OpenTrepWrapper.py
67 lines (50 loc) · 2 KB
/
test_OpenTrepWrapper.py
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# -*- coding: utf-8 -*-
#
# Source: https://github.com/trep/wrapper/tree/master/test_OpenTrepWrapper.py
#
# Authors: Denis Arnaud, Alex Prengere
#
import unittest
import OpenTrepWrapper
class OpenTrepWrapperTest(unittest.TestCase):
def test_initOpenTrepLib(self):
# DEBUG
print("[OTP][test_initOpenTrepLib] - Initializing OpenTrepLib...")
otp = OpenTrepWrapper.OpenTrepLib()
self.assertIsNotNone(otp)
#
otp.init_cpp_extension()
def test_get_paths(self):
# DEBUG
print("[OTP][test_get_paths] - Get the file-paths...")
otp = OpenTrepWrapper.OpenTrepLib()
self.assertIsNotNone(otp)
#
otp.init_cpp_extension(por_path=None,
xapian_index_path="/tmp/opentrep/xapian_traveldb",
sql_db_type="nodb",
sql_db_conn_str=None,
deployment_nb=0,
log_path="test_OpenTrepWrapper.log",
log_level=5)
file_path_list = otp.getPaths()
# DEBUG
print(f"[OTP][test_get_paths] - File-path list: {file_path_list}")
self.assertEqual(file_path_list, None)
def test_index_test_por_file(self):
# DEBUG
print("[OTP][test_index_test_por_file] - Index with the test file...")
otp = OpenTrepWrapper.OpenTrepLib()
self.assertIsNotNone(otp)
#
otp.init_cpp_extension(por_path=None,
xapian_index_path="/tmp/opentrep/xapian_traveldb",
sql_db_type="nodb",
sql_db_conn_str=None,
deployment_nb=0,
log_path="test_OpenTrepWrapper.log",
log_level=5)
# Index the POR test file
otp.index()
# Search
otp.search(search_string="nce sfo", outputFormat="F")