From 958067721b83d896d9090a1f55b8f404a52b5058 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ab=C3=ADlio=20Azevedo?= <abilio10@gmail.com>
Date: Fri, 13 Oct 2023 23:52:17 -0300
Subject: [PATCH] test: adding more tests to hash table algorithm

---
 data_structures/hashing/hash_table.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/data_structures/hashing/hash_table.py b/data_structures/hashing/hash_table.py
index 7ca2f7c401cf..319fdc16ae0f 100644
--- a/data_structures/hashing/hash_table.py
+++ b/data_structures/hashing/hash_table.py
@@ -5,6 +5,20 @@
 class HashTable:
     """
     Basic Hash Table example with open addressing and linear probing
+    >>> ht = HashTable(10)
+    >>> ht.insert_data('foo')
+    >>> ht.insert_data('bar')
+    >>> len(ht.keys())
+    2
+
+    >>> 'foo' in ht.keys().values()
+    True
+    >>> ht.insert_data('foo')  # Duplicates allowed
+    >>> ht.values.count('foo')
+    1
+
+    >>> ht.balanced_factor()
+    0.2
     """
 
     def __init__(
@@ -29,7 +43,7 @@ def balanced_factor(self):
         )
 
     def hash_function(self, key):
-        return key % self.size_table
+        return hash(key) % self.size_table
 
     def _step_by_step(self, step_ord):
         print(f"step {step_ord}")