Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

test_fileio.py 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import unittest
  2. import sys
  3. import os
  4. import odml
  5. try:
  6. from StringIO import StringIO
  7. except ImportError:
  8. from io import StringIO
  9. class TestTypes(unittest.TestCase):
  10. # TODO :- Write tests for JSONParser once it's completed.
  11. def setUp(self):
  12. self.file = 'doc/example_odMLs/THGTTG.odml'
  13. # Do not allow anything to be printed on STDOUT
  14. self.captured_stdout = StringIO()
  15. sys.stdout = self.captured_stdout
  16. def test_load_save(self):
  17. doc = odml.load(self.file)
  18. self.assertTrue(isinstance(doc, odml.doc.BaseDocument))
  19. odml.save(doc, self.file + '_copy')
  20. os.remove(self.file + '_copy')
  21. def test_display(self):
  22. doc = odml.load(self.file)
  23. odml.display(doc)
  24. def test_invalid_parser(self):
  25. with self.assertRaises(NotImplementedError):
  26. odml.load(self.file, 'html')
  27. doc = odml.load(self.file)
  28. with self.assertRaises(NotImplementedError):
  29. odml.save(doc, self.file + '_copy_html', 'html')
  30. with self.assertRaises(NotImplementedError):
  31. odml.display(doc, 'html')