# Path: gsdview/utils.py
# def default_workdir():
# def _getresource(resource, package):
# def getresource(resource, package=None):
# def format_platform_info():
# def format_bugreport(exctype=None, excvalue=None, tracebackobj=None,
#                      extra_info=None):
#     def isexecutable(cmd):
#     def isexecutable(cmd):
# def isscript(filename):
# def scriptcmd(scriptname):
#     def get_tree_size(path):
#     def get_tree_size(path):
# def data_uuid(path, prefixlen=23):
# def geonormalize(x, angle_range=360.):


import os
import shutil
import tempfile
import unittest
from gsdview import utils
    def test_data_uuid_consistency(self):
        data_uuid1 = utils.data_uuid(self.fd.name)
        self.fd.seek(0)
        data = self.fd.read()
        data_uuid2 = utils.data_uuid(self.fd.name)
        self.assertEqual(data_uuid1, data_uuid2)

    def test_data_uuid_filename(self):
        data_uuid1 = utils.data_uuid(self.fd.name)

        self.fd.seek(0)
        data = self.fd.read()
        with tempfile.NamedTemporaryFile(
                prefix='gsdview_test_utils_', suffix='.dat') as fd:
            data_uuid2 = utils.data_uuid(fd.name)
        self.assertNotEqual(data_uuid1, data_uuid2)

    def test_data_uuid_newfile(self):
        data_uuid1 = utils.data_uuid(self.fd.name)

        self.fd.seek(0)
        data = self.fd.read()
        filename = self.fd.name
        self.fd.file.close()

        with open(filename, 'w+b') as fd:
            fd.write(data)
            data_uuid2 = utils.data_uuid(filename)
        # filename is unlinked by NamedTemporaryFile __del__ method
        # os.remove(filename)

# Path: gsdview/utils.py
# def default_workdir():
# def _getresource(resource, package):
# def getresource(resource, package=None):
# def format_platform_info():
# def format_bugreport(exctype=None, excvalue=None, tracebackobj=None,
#                      extra_info=None):
#     def isexecutable(cmd):
#     def isexecutable(cmd):
# def isscript(filename):
# def scriptcmd(scriptname):
#     def get_tree_size(path):
#     def get_tree_size(path):
# def data_uuid(path, prefixlen=23):
# def geonormalize(x, angle_range=360.):


# Path: tests/test_utils.py
import os
import shutil
import tempfile
import unittest
from gsdview import utils

    def test_data_uuid_consistency(self):
        data_uuid1 = utils.data_uuid(self.fd.name)
        self.fd.seek(0)
        data = self.fd.read()
        data_uuid2 = utils.data_uuid(self.fd.name)
        self.assertEqual(data_uuid1, data_uuid2)

    def test_data_uuid_filename(self):
        data_uuid1 = utils.data_uuid(self.fd.name)

        self.fd.seek(0)
        data = self.fd.read()
        with tempfile.NamedTemporaryFile(
                prefix='gsdview_test_utils_', suffix='.dat') as fd:
            data_uuid2 = utils.data_uuid(fd.name)
        self.assertNotEqual(data_uuid1, data_uuid2)

    def test_data_uuid_newfile(self):
        data_uuid1 = utils.data_uuid(self.fd.name)

        self.fd.seek(0)
        data = self.fd.read()
        filename = self.fd.name
        self.fd.file.close()

        with open(filename, 'w+b') as fd:
            fd.write(data)
            data_uuid2 = utils.data_uuid(filename)
        # filename is unlinked by NamedTemporaryFile __del__ method
        # os.remove(filename)

        self.assertNotEqual(data_uuid1, data_uuid2)