def test_hash(self): # Arrange uuid1 = UUID(value=b"\x12\x34\x56\x78" * 4) uuid2 = UUID(value=b"\x12\x34\x56\x78" * 4) # Act # Assert assert isinstance((hash(uuid1)), int) assert hash(uuid1) == hash(uuid2)
def test_comparison(self): # Arrange # Act uuid1 = UUID(value=b"\x12\x34\x56\x78" * 4) uuid2 = UUID(value=b"\x34\x56\x78\x99" * 4) # Assert assert uuid1 <= uuid1 assert uuid1 < uuid2 assert uuid2 >= uuid2 assert uuid2 > uuid1
def test_equality(self): # Arrange # Act uuid1 = UUID(value=b"\x12\x34\x56\x78" * 4) uuid2 = UUID(value=b"\x12\x34\x56\x78" * 4) uuid3 = UUID(value=b"\x34\x56\x78\x99" * 4) # Assert assert uuid1 == uuid1 assert uuid1 == uuid2 assert uuid2 != uuid3
def test_create_uuid_from_hex_string_value(self): # Arrange # Act uuid_object1 = UUID("{12345678-1234-5678-1234-567812345678}") uuid_object2 = UUID("12345678123456781234567812345678") uuid_object3 = UUID("urn:uuid:12345678-1234-5678-1234-567812345678") # Assert self.assertEqual("UUID(\'12345678-1234-5678-1234-567812345678\')", repr(uuid_object1)) self.assertEqual("UUID(\'12345678-1234-5678-1234-567812345678\')", repr(uuid_object2)) self.assertEqual("UUID(\'12345678-1234-5678-1234-567812345678\')", repr(uuid_object3))
def test_hex(self): # Arrange uuid = UUID(value=b'\x12\x34\x56\x78' * 4) # Act # Assert assert "12345678123456781234567812345678" == uuid.hex
def test_node(self): # Arrange uuid = UUID(value=b'\x12\x34\x56\x78' * 4) # Act # Assert assert 95073701484152 == uuid.node
def test_clock_seq(self): # Arrange uuid = UUID(value=b'\x12\x34\x56\x78' * 4) # Act # Assert assert 4660 == uuid.clock_seq
def test_time(self): # Arrange uuid = UUID(value=b'\x12\x34\x56\x78' * 4) # Act # Assert assert 466142576285865592 == uuid.time
def test_clock_seq_hi_variant(self): # Arrange uuid = UUID(value=b'\x12\x34\x56\x78' * 4) # Act # Assert assert 18 == uuid.clock_seq_hi_variant
def test_time_high_version(self): # Arrange uuid = UUID(value=b'\x12\x34\x56\x78' * 4) # Act # Assert assert 22136 == uuid.time_hi_version
def test_time_mid(self): # Arrange uuid = UUID(value=b'\x12\x34\x56\x78' * 4) # Act # Assert assert 4660 == uuid.time_mid
def test_fields(self): # Arrange uuid = UUID(value=b"\x12\x34\x56\x78" * 4) # Act # Assert assert uuid.fields == (305419896, 4660, 22136, 18, 52, 95073701484152)
def test_bytes(self): # Arrange uuid = UUID(value=b"\x12\x34\x56\x78" * 4) # Act # Assert assert b"\x124Vx\x124Vx\x124Vx\x124Vx" == uuid.bytes
def test_time_high_version(self): # Arrange uuid = UUID(value=b"\x12\x34\x56\x78" * 4) # Act # Assert assert uuid.time_hi_version == 22136
def test_clock_seq_hi_variant(self): # Arrange uuid = UUID(value=b"\x12\x34\x56\x78" * 4) # Act # Assert assert uuid.clock_seq_hi_variant == 18
def test_time_mid(self): # Arrange uuid = UUID(value=b"\x12\x34\x56\x78" * 4) # Act # Assert assert uuid.time_mid == 4660
def test_time_low(self): # Arrange uuid = UUID(value=b"\x12\x34\x56\x78" * 4) # Act # Assert assert uuid.time_low == 305419896
def test_time_low(self): # Arrange uuid = UUID(value=b'\x12\x34\x56\x78' * 4) # Act # Assert assert 305419896 == uuid.time_low
def test_time(self): # Arrange uuid = UUID(value=b"\x12\x34\x56\x78" * 4) # Act # Assert assert uuid.time == 466142576285865592
def test_clock_seq(self): # Arrange uuid = UUID(value=b"\x12\x34\x56\x78" * 4) # Act # Assert assert uuid.clock_seq == 4660
def test_bytes_le(self): # Arrange uuid = UUID(value=b'\x12\x34\x56\x78' * 4) # Act # Assert assert b'xV4\x124\x12xV\x124Vx\x124Vx' == uuid.bytes_le
def test_urn(self): # Arrange uuid = UUID(value=b"\x12\x34\x56\x78" * 4) # Act # Assert assert uuid.urn == "urn:uuid:12345678-1234-5678-1234-567812345678"
def test_hex(self): # Arrange uuid = UUID(value=b"\x12\x34\x56\x78" * 4) # Act # Assert assert uuid.hex == "12345678123456781234567812345678"
def test_node(self): # Arrange uuid = UUID(value=b"\x12\x34\x56\x78" * 4) # Act # Assert assert uuid.node == 95073701484152
def test_create_uuid_from_int_val(self): # Arrange # Act uuid_object = UUID(int_val=0x12345678123456781234567812345678) # Assert self.assertEqual("UUID(\'12345678-1234-5678-1234-567812345678\')", repr(uuid_object))
def test_int(self): # Arrange uuid = UUID(value=b"\x12\x34\x56\x78" * 4) # Act # Assert assert int(uuid) == 24197857161011715162171839636988778104 assert uuid.int_val == 24197857161011715162171839636988778104
def test_int(self): # Arrange uuid = UUID(value=b'\x12\x34\x56\x78' * 4) # Act # Assert assert 24197857161011715162171839636988778104 == int(uuid) assert 24197857161011715162171839636988778104 == uuid.int_val
def test_create_uuid_from_bytes_val(self): # Arrange # Act uuid_object = UUID(bytes_val=b'\x12\x34\x56\x78' * 4) # Assert self.assertEqual("UUID(\'12345678-1234-5678-1234-567812345678\')", repr(uuid_object))
def test_create_uuid3(self): # Arrange # Act uuid_object = uuid3(UUID("6ba7b810-9dad-11d1-80b4-00c04fd430c8"), "some_name") # Assert self.assertTrue(isinstance(uuid_object, UUID))
def test_create_uuid_from_fields_tuple(self): # Arrange # Act uuid_object = UUID(fields=(0x12345678, 0x1234, 0x5678, 0x12, 0x34, 0x567812345678)) # Assert self.assertEqual("UUID(\'12345678-1234-5678-1234-567812345678\')", repr(uuid_object))