<s> import unittest <EOL> import struct <EOL> import re <EOL> from vcdm . server . cdmi . common import generate_guid , generate_guid_b64 <EOL> class GuidGenTestCase ( unittest . TestCase ) : <EOL> def testGuidIsTimeDependent ( self ) : <EOL> guid1 = generate_guid ( ) <EOL> guid2 = generate_guid ( ) <EOL> self . assertNotEqual ( guid1 , guid2 ) <EOL> def testBasic64Conversion ( self ) : <EOL> guid = generate_guid_b64 ( ) <EOL> self . assertTrue ( re . match ( '<STR_LIT>' , guid ) ) <EOL> def testMustBeVendorDependent ( self ) : <EOL> guid1 = generate_guid ( entnumber = <NUM_LIT> ) <EOL> guid2 = generate_guid ( entnumber = <NUM_LIT> ) <EOL> self . assertNotEqual ( guid1 [ <NUM_LIT:0> : <NUM_LIT:4> ] , guid2 [ <NUM_LIT:0> : <NUM_LIT:4> ] ) <EOL> def testSizeMustReflectTheGuidSize ( self ) : <EOL> guid = generate_guid ( ) <EOL> guiddata = struct . unpack ( '<STR_LIT>' + '<STR_LIT:p>' * ( len ( guid ) - <NUM_LIT:8> ) , guid ) <EOL> self . assertEqual ( len ( guid ) , guiddata [ <NUM_LIT:2> ] ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
