We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 031b60b commit f9cd3ddCopy full SHA for f9cd3dd
python-pybind/tests/test_tools.py
@@ -0,0 +1,21 @@
1
+# -*- coding: utf-8 -*-
2
+# some common tools for tests
3
+
4
+import contextlib
5
+import os
6
+import tempfile
7
8
+from keyvi_scikit_core.dictionary import Dictionary
9
10
11
+@contextlib.contextmanager
12
+def tmp_dictionary(compiler, file_name):
13
+ tmp_dir = tempfile.gettempdir()
14
+ fq_file_name = os.path.join(tmp_dir, file_name)
15
+ compiler.Compile()
16
+ compiler.WriteToFile(fq_file_name)
17
+ del compiler
18
+ d = Dictionary(fq_file_name)
19
+ yield d
20
+ del d
21
+ os.remove(fq_file_name)
0 commit comments