This fork extends the command line interface (CLI) and is distributed as a convenient one-file-executable (Windows, Linux, Mac). It is also available via Docker Hub, PyPI and Binder.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

53 lines
1.5 KiB

  1. #!/usr/bin/env python
  2. """
  3. refinetest.py
  4. RefineTestCase is a base class that loads Refine projects specified by
  5. the class's 'project_file' attribute and provides a 'project' object.
  6. These tests require a connection to a Refine server either at
  7. http://127.0.0.1:3333/ or by specifying environment variables REFINE_HOST
  8. and REFINE_PORT.
  9. """
  10. # Copyright (c) 2011 Paul Makepeace, Real Programmers. All rights reserved.
  11. import os
  12. import unittest
  13. from google.refine import refine
  14. PATH_TO_TEST_DATA = os.path.join(os.path.dirname(__file__), 'data')
  15. #noinspection PyPep8Naming
  16. class RefineTestCase(unittest.TestCase):
  17. project_file = None
  18. project_format = 'text/line-based/*sv'
  19. project_options = {}
  20. project = None
  21. # Section "2. Exploration using Facets": {1}, {2}
  22. def project_path(self):
  23. return os.path.join(PATH_TO_TEST_DATA, self.project_file)
  24. def setUp(self):
  25. self.server = refine.RefineServer()
  26. self.refine = refine.Refine(self.server)
  27. if self.project_file:
  28. self.project = self.refine.new_project(
  29. project_file=self.project_path(), project_format=self.project_format, **self.project_options)
  30. def tearDown(self):
  31. if self.project:
  32. self.project.delete()
  33. self.project = None
  34. def assertInResponse(self, expect):
  35. desc = None
  36. try:
  37. desc = self.project.history_entry.description
  38. self.assertTrue(expect in desc)
  39. except AssertionError:
  40. raise AssertionError('Expecting "%s" in "%s"' % (expect, desc))