Python Forum
Mix-in class tree file not running the self test code.
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Mix-in class tree file not running the self test code.
#2
Howdy Arjun!
On line 51 of your listtree.py file you have a typo. self.__class.__name__,
Should instead be self.__class__.__name__,

The error message alerts you of this by saying AttributeError: 'Sub' object has no attribute '_ListTree__class'



Without the trailing '__' on __class__ python 'mangles' the method call for self.__class to make it call a private method 'self._ListTree__class'
'self' in this case is the Sub class from testmixin.py the interpreter throws the error before moving to the .__name__ portion of your code on line 51.



Hope this helped sort your problem.

-Retrubtion
Reply


Messages In This Thread
RE: Mix-in class tree file not running the self test code. - by Retrubtion - Aug-10-2018, 10:22 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How does this code create a class? Pedroski55 6 444 Apr-21-2024, 06:15 AM
Last Post: Gribouillis
  problem in running a code akbarza 7 672 Feb-14-2024, 02:57 PM
Last Post: snippsat
  super() and order of running method in class inheritance akbarza 7 778 Feb-04-2024, 09:35 AM
Last Post: Gribouillis
  Class test : good way to split methods into several files paul18fr 4 491 Jan-30-2024, 11:46 AM
Last Post: Pedroski55
  writing and running code in vscode without saving it akbarza 1 398 Jan-11-2024, 02:59 PM
Last Post: deanhystad
  the order of running code in a decorator function akbarza 2 536 Nov-10-2023, 08:09 AM
Last Post: akbarza
  error "cannot identify image file" part way through running hatflyer 0 683 Nov-02-2023, 11:45 PM
Last Post: hatflyer
  Python Code for Preorder Traversal of a Binary Tree Bolt 1 606 Sep-22-2023, 09:32 AM
Last Post: Gribouillis
  unittest generates multiple files for each of my test case, how do I change to 1 file zsousa 0 975 Feb-15-2023, 05:34 PM
Last Post: zsousa
  "Name is not defined" when running a class lil_e 6 4,067 Jan-12-2023, 11:57 PM
Last Post: lil_e

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020