Beispiel #1
0
 def test_compatibility_read_write(self):
   for record in [b'', b'blah', b'another blah']:
     file_handle = io.BytesIO()
     _TFRecordUtil.write_record(file_handle, record)
     file_handle.seek(0)
     actual = _TFRecordUtil.read_record(file_handle)
     self.assertEqual(record, actual)
 def test_compatibility_read_write(self):
   for record in ['', 'blah', 'another blah']:
     file_handle = cStringIO.StringIO()
     _TFRecordUtil.write_record(file_handle, record)
     file_handle.reset()
     actual = _TFRecordUtil.read_record(file_handle)
     self.assertEqual(record, actual)
Beispiel #3
0
 def test_compatibility_read_write(self):
     for record in ['', 'blah', 'another blah']:
         file_handle = cStringIO.StringIO()
         _TFRecordUtil.write_record(file_handle, record)
         file_handle.reset()
         actual = _TFRecordUtil.read_record(file_handle)
         self.assertEqual(record, actual)
 def test_compatibility_read_write(self):
   for record in ['', 'blah', 'another blah']:
     file_handle = io.BytesIO()
     _TFRecordUtil.write_record(file_handle, record)
     file_handle.seek(0)
     actual = _TFRecordUtil.read_record(file_handle)
     self.assertEqual(record, actual)
Beispiel #5
0
 def test_read_record(self):
   actual = _TFRecordUtil.read_record(self._as_file_handle(self.record))
   self.assertEqual(b'foo', actual)
Beispiel #6
0
 def _test_error(self, record, error_text):
   with self.assertRaisesRegex(ValueError, re.escape(error_text)):
     _TFRecordUtil.read_record(self._as_file_handle(record))
 def _test_error(self, record, error_text):
   with self.assertRaises(ValueError) as context:
     _TFRecordUtil.read_record(self._as_file_handle(record))
   self.assertIn(error_text, context.exception.message)
 def test_read_record(self):
   actual = _TFRecordUtil.read_record(self._as_file_handle(self.record))
   self.assertEqual('foo', actual)
Beispiel #9
0
 def _test_error(self, record, error_text):
     with self.assertRaises(ValueError) as context:
         _TFRecordUtil.read_record(self._as_file_handle(record))
     self.assertIn(error_text, context.exception.message)
 def _test_error(self, record, error_text):
   with self.assertRaisesRegexp(ValueError, re.escape(error_text)):
     _TFRecordUtil.read_record(self._as_file_handle(record))