-
Notifications
You must be signed in to change notification settings - Fork 406
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#3521] fix(client-python): Fix
hash()
function with multiple varia…
…bles issue in `name_identitifer` (#3532) ### What changes were proposed in this pull request? Fix `hash()` function in `name_identifier`. ### Why are the changes needed? Fix: #3521 ### How was this patch tested? Add a ut. Co-authored-by: xloya <982052490@qq.com> Co-authored-by: xiaojiebao <xiaojiebao@xiaomi.com>
- Loading branch information
1 parent
da62f1d
commit 587be02
Showing
2 changed files
with
23 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
clients/client-python/tests/unittests/test_name_identifier.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
""" | ||
Copyright 2024 Datastrato Pvt Ltd. | ||
This software is licensed under the Apache License version 2. | ||
""" | ||
|
||
import unittest | ||
|
||
from gravitino import NameIdentifier | ||
|
||
|
||
class TestNameIdentifier(unittest.TestCase): | ||
def test_name_identifier_hash(self): | ||
name_identifier1: NameIdentifier = NameIdentifier.of_fileset( | ||
"test_metalake", "test_catalog", "test_schema", "test_fileset1" | ||
) | ||
name_identifier2: NameIdentifier = NameIdentifier.of_fileset( | ||
"test_metalake", "test_catalog", "test_schema", "test_fileset2" | ||
) | ||
identifier_dict = {name_identifier1: "test1", name_identifier2: "test2"} | ||
|
||
self.assertEqual("test1", identifier_dict.get(name_identifier1)) | ||
self.assertNotEqual("test2", identifier_dict.get(name_identifier1)) |