Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TDD Hashtag table - TypeError in 01_define_a_custom_hashtable_class #253

Open
EmersonSchindex opened this issue Mar 21, 2022 · 1 comment

Comments

@EmersonSchindex
Copy link

source: hashtable.py in 01_define_a_custom_hashtable_class

Describe the bug
running the test throws an error for line self.values = capacity * [None]
TypeError: cant multiply sequence by non-int of type ' NoneType'

That's a pity, because I really like this TDD cource!

Running on Windows 10 with python version 3.7.3

@bzaczynski
Copy link
Contributor

@EmersonSchindex There's not enough information in this issue description to reproduce the problem. However, the error message indicates that the HashTable class must have been instantiated with an unexpected None passed as an argument:

>>> HashTable(None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in __init__
TypeError: can't multiply sequence by non-int of type 'NoneType'

All the implemented tests pass on Python 3.7.3 upon cloning the repository:

$ git clone git@github.com:realpython/materials.git
$ cd materials/hashtable/
$ pyenv local 3.7.3
$ python -m venv venv
$ source venv/bin/activate
(venv) $ python -m pip install -r requirements.txt
(venv) $ pytest 01_hashtable_prototype/01_define_a_custom_hashtable_class/
============================= test session starts =============================
platform linux -- Python 3.7.3, pytest-7.0.1, pluggy-1.0.0
rootdir: /home/realpython/materials/hashtable
plugins: unordered-0.4.1
collected 3 items                                                             

01_hashtable_prototype/01_define_a_custom_hashtable_class/test_hashtable.py ...                                                                      [100%]

============================== 3 passed in 0.01s ==============================

How did you arrive at this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants