# Path: tensorboardX/record_writer.py
# class RecordWriter(object):
#     def __init__(self, path):
#         self._name_to_tf_name = {}
#         self._tf_names = set()
#         self.path = path
#         self._writer = None
#         self._writer = open_file(path)
# 
#     def write(self, data):
#         w = self._writer.write
#         header = struct.pack('Q', len(data))
#         w(header)
#         w(struct.pack('I', masked_crc32c(header)))
#         w(data)
#         w(struct.pack('I', masked_crc32c(data)))
# 
#     def flush(self):
#         self._writer.flush()
# 
#     def close(self):
#         self._writer.close()


import six
import os
import unittest
    import tempfile
from tensorboardX.record_writer import RecordWriter
from tensorboard.compat.tensorflow_stub.pywrap_tensorflow import PyRecordReader_New
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

# """Tests for RecordWriter"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function



class RecordWriterTest(unittest.TestCase):
  def get_temp_dir(self):
    return tempfile.mkdtemp()

  def test_expect_bytes_written(self):
    filename = os.path.join(self.get_temp_dir(), "expect_bytes_written")
    byte_len = 64

# Path: tensorboardX/record_writer.py
# class RecordWriter(object):
#     def __init__(self, path):
#         self._name_to_tf_name = {}
#         self._tf_names = set()
#         self.path = path
#         self._writer = None
#         self._writer = open_file(path)
# 
#     def write(self, data):
#         w = self._writer.write
#         header = struct.pack('Q', len(data))
#         w(header)
#         w(struct.pack('I', masked_crc32c(header)))
#         w(data)
#         w(struct.pack('I', masked_crc32c(data)))
# 
#     def flush(self):
#         self._writer.flush()
# 
#     def close(self):
#         self._writer.close()


# Path: tests/record_writer_test.py
import six
import os
import unittest
    import tempfile
from tensorboardX.record_writer import RecordWriter
from tensorboard.compat.tensorflow_stub.pywrap_tensorflow import PyRecordReader_New

# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================

# """Tests for RecordWriter"""

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function



class RecordWriterTest(unittest.TestCase):
  def get_temp_dir(self):
    return tempfile.mkdtemp()

  def test_expect_bytes_written(self):
    filename = os.path.join(self.get_temp_dir(), "expect_bytes_written")
    byte_len = 64

    w = RecordWriter(filename)