Need Python Unit Testing Help


#1

I am new to coding and I am reading the Python Crash Course. I am working on unit testing and I am trying to figure out why I got an error from the code below. I confirmed that the code that is imported works before trying the unit test. Thanks in advance.


#2

If you believe this to be a question about Python unit testing instead of about Atom or Hydrogen, you stand a better chance of finding helpful input if you ask on a site where the majority of the users are well-versed in Python. Additionally, the screenshot you’ve posted does not show the full text of the error, so it’s difficult to identify what the problem is.

Without the full text of the error, I notice two things:

  1. Your function isn’t inside your class. Is it supposed to be? If the class doesn’t contain anything, what is it supposed to do? Have you tried executing the code with the function inside the class?
  2. The attribute cited in the AttributeError starts with a long system path that points inside your Jupyter folder. Have you tried running the code with a package like script to make sure that the problem doesn’t have something to do with Hydrogen?

#3

It ran fine with Script so there must be an issue with Hydrogen. Thanks. I’ll do some more research to try and identify the issue.


#4

What does the full text of the error say?


#5

Here you go:


#6

Yep, that’s definitely over my head.