Beispiel #1
0
 def setUp(self):
     """
     Generate the file path to the exa.editor module (which will be used as
     the test for the :class:`~exa.editor.Editor` class that it provides).
     """
     self.path = mkp(config['dynamic']['pkgdir'], 'editor.py')
     with open(self.path) as f:
         self.lines = f.readlines()
     self.fl = Editor.from_file(self.path)
Beispiel #2
0
 def test_loaders(self):
     """
     The editor provides there different methods for instantiation; from a
     file on disk, from a file stream, or from a string.
     """
     fl = Editor.from_file(self.path)
     with open(self.path) as f:
         tm = Editor.from_stream(f)
         f.seek(0)
         tr = Editor.from_string(f.read())
     self.assertTrue(len(self.lines) == len(fl) == len(tm) == len(tr))
     self.assertTrue(all(fl[i] == tm[i] == tr[i] for i in range(len(self.lines))))