def record_events_to_file(self, filename="record.log"): """ Records events during the interaction. The recording is represented as a list of VTK events that happened during the interaction. The recording is going to be saved into `filename`. Parameters ---------- filename : str Name of the file that will contain the recording (.log|.log.gz). """ events = self.record_events() # Compress file if needed if filename.endswith(".gz"): with gzip.open(filename, 'wb') as fgz: fgz.write(asbytes(events)) else: with open(filename, 'w') as f: f.write(events)
def test_asbytes(): text = [b'test', 'test'] for t in text: npt.assert_equal(utils.asbytes(t), b'test')
def test_asbytes(): text = [b'test', 'test'] if sys.version_info[0] >= 3: for t in text: npt.assert_equal(utils.asbytes(t), b'test')