This repository has been archived by the owner on Dec 8, 2024. It is now read-only.
forked from paulmakepeace/refine-client-py
-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathrefinetest.py
52 lines (40 loc) · 1.55 KB
/
refinetest.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
#!/usr/bin/env python
"""
refinetest.py
RefineTestCase is a base class that loads Refine projects specified by
the class's 'project_file' attribute and provides a 'project' object.
These tests require a connection to a Refine server either at
http://127.0.0.1:3333/ or by specifying environment variables REFINE_HOST
and REFINE_PORT.
"""
# Copyright (c) 2011 Paul Makepeace, Real Programmers. All rights reserved.
import os
import unittest
from google.refine import refine
PATH_TO_TEST_DATA = os.path.join(os.path.dirname(__file__), 'data')
#noinspection PyPep8Naming
class RefineTestCase(unittest.TestCase):
project_file = None
project_format = 'text/line-based/*sv'
project_options = {}
project = None
# Section "2. Exploration using Facets": {1}, {2}
def project_path(self):
return os.path.join(PATH_TO_TEST_DATA, self.project_file)
def setUp(self):
self.server = refine.RefineServer()
self.refine = refine.Refine(self.server)
if self.project_file:
self.project = self.refine.new_project(
project_file=self.project_path(), project_format=self.project_format, **self.project_options)
def tearDown(self):
if self.project:
self.project.delete()
self.project = None
def assertInResponse(self, expect):
desc = None
try:
desc = self.project.history_entry.description
self.assertTrue(expect in desc)
except AssertionError:
raise AssertionError('Expecting "%s" in "%s"' % (expect, desc))