what causes AttributeError?


AttributeError happens when a name that is NOT in an object (everything in Python is an object) is used.


what is an attribute?

An attribute is a name (variable?) for something that belongs to an object (a class), for example, a human being has attributes like height, weight, sex and color, they are also known as properties.


preview

I have these tests by the end of the chapter

questions about TypeError

Questions to think about as I go through the chapter


start the project

  • I name this project attribute_error

  • I open a terminal

  • I change directory to the attribute_error folder in the pumping_python folder

    cd attribute_error
    

    the terminal shows

    cd: no such file or directory: attribute_error
    

    there is no folder with the name attribute_error in this folder.

  • I use uv to make a directory for the project and initialize it

    uv init attribute_error
    

    the terminal shows

    Initialized project `attribute-error`
    at `.../pumping_python/attribute_error`
    

    then goes back to the command line.

  • I change directory to the project

    cd attribute_error
    

    the terminal shows I am in the attribute_error folder

    .../pumping_python/attribute_error
    
  • I make a directory for the tests

    mkdir tests
    

    the terminal goes back to the command line.

  • I make the tests directory a Python package

    Danger

    use 2 underscores (__) before and after init for __init__.py not _init_.py

    touch tests/__init__.py
    
    New-Item tests/__init__.py
    

    the terminal goes back to the command line.

  • I make a Python file for the tests in the tests directory

    touch tests/test_attribute_error.py
    
    New-Item tests/test_attribute_error.py
    

    the terminal goes back to the command line.

  • I use the mv program to change the name of main.py to test_attribute_error.py and move it to the tests folder

    mv main.py tests/test_attribute_error.py
    
    Move-Item main.py tests/test_attribute_error.py
    

    the terminal goes back to the command line.

  • I open test_attribute_error.py

  • I delete all the text then add the first failing test to test_a.py

    1def test_failure():
    2    assert False is True
    
  • I go back to the terminal to make a requirements file for the Python packages I need

    echo "pytest" > requirements.txt
    

    the terminal goes back to the command line.

  • I add pytest-watcher to the requirements file

    echo "pytest-watcher" >> requirements.txt
    

    the terminal goes back to the command line.

  • I use uv to install pytest-watcher with the requirements file

    uv add --requirement requirements.txt
    

    the terminal shows that it installed pytest-watcher and its dependencies.

  • I add the new files and folder to git for tracking

    git add .
    

    the terminal goes back to the command line.

  • I add a git commit message

    git commit -am 'setup project'
    

    the terminal shows a summary of the changes then goes back to the command line.

  • I use pytest-watcher to run the tests automatically

    uv run pytest-watcher . --now
    

    the terminal is my friend, and shows AssertionError

    ======================== FAILURES ========================
    ______________________ test_failure ______________________
    
        def test_failure():
    >       assert False is True
    E       assert False is True
    
    test_attribute_error.py:2: AssertionError
    ================ short test summary info =================
    FAILED test_attribute_error.py::test_failure - assert False is True
    =================== 1 failed in X.YZs ====================
    

    because True is NOT False

    if the terminal does not show the same error, then check

    • if your tests/__init__.py has two underscores (__) before and after init for __init__.py not _init_.py

    • if you ran echo "pytest-watcher" >> requirements.txt, to add pytest-watcher to the requirements file

    fix those errors and try to run uv run pytest-watcher . --now again

  • I add AssertionError to the list of Exceptions seen in test_attribute_error.py

    1def test_failure():
    2    assert False is True
    3
    4
    5# Exceptions seen
    6# AssertionError
    
  • I change True to False in the assertion

    1def test_failure():
    2    # assert False is True
    3    assert False is False
    4
    5
    6# Exceptions seen
    7# AssertionError
    

    the test passes.

  • I add an import statement at the top of test_attribute_error.py

    1import src.attribute_error
    

    the terminal is my friend, and shows ModuleNotFoundError

    ModuleNotFoundError: No module named 'src'
    

    because Python cannot find anything named src in this project.

  • I add ModuleNotFoundError to the list of Exceptions seen

     9# Exceptions seen
    10# AssertionError
    11# ModuleNotFoundError
    
  • I open a new terminal then change directories to attribute_error

    cd attribute_error
    
  • I use mkdir to make a folder named src in the project

    mkdir src
    
  • I go back to the terminal where the tests are running

  • I go to test_attribute_error.py and use ctrl/command+s on the keyboard to run the test again. The terminal shows ModuleNotFoundError

    ModuleNotFoundError: No module named 'src.attribute_error'
    

    because there is nothing named attribute_error in the src folder

  • I go to the second terminal

  • I use touch to make attribute_error.py in the src folder

    touch src/attribute_error.py
    
  • I go to the terminal where the tests are running and it shows the test is green again.


test_attribute_error_w_variables

AttributeError happens when I use a variable that does not exist in an object.


RED: make it fail


  • I change test_failure to test_attribute_error_w_variables

    1import src.attribute_error
    2
    3
    4def test_attribute_error_w_variables():
    5    src.attribute_error.variable_00
    6
    7
    8# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'variable_00'
    

    because when src.attribute.variable_00 runs, Python follows this path

    src
    └── attribute_error.py
        └── variable_00 # does not exist in attribute_error.py
    

    which raises AttributeError since there is nothing named variable_00 in attribute_error.py in the src folder, it is empty.

  • I add AttributeError to the list of Exceptions seen in test_attribute_error.py

     8# Exceptions seen
     9# AssertionError
    10# ModuleNotFoundError
    11# AttributeError
    

GREEN: make it pass


  • I open attribute_error.py from the src folder

  • I add variable_00 to attribute_error.py

    1variable_00
    

    the terminal is my friend, and shows NameError

    NameError: name 'variable_00' is not defined
    

    because I used a name that is not defined in this file

  • I add NameError to the list of Exceptions seen in test_attribute_error.py

     8# Exceptions seen
     9# AssertionError
    10# ModuleNotFoundError
    11# AttributeError
    12# NameError
    
  • I point variable_00 to None to define it, in attribute_error.py

    1# variable_00
    2variable_00 = None
    

    the test passes because

    • When import src.attribute_error runs, Python brings in an object for the attribute_error.py file from the src folder so I can use it in test_attribute_error.py as src.attribute_error.

    • When src.attribute_error.variable_00 runs, Python looks at what the variable_00 variable from the object it imported for the attribute_error.py file from the src folder (src.attribute_error) points to.

    I think of src.attribute_error.variable_00 like an address

    src
    └── attribute_error.py
        └── variable_00 = None
    
    • variable_00 is something in attribute_error, in this case it is a variable in attribute_error

    • attribute_error is something in src, in this case it is attribute_error.py (a module) in the src folder

    • src is something Python can import (a module, Python package or folder)

    • variable_00 is now an attribute/property of attribute_error.py in the src folder. I can use it from outside the file with src.attribute_error.variable_00


REFACTOR: make it better


  • I add a statement for variable_01 to test_attribute_error.py

    4def test_attribute_error_w_variables():
    5    src.attribute_error.variable_00
    6    src.attribute_error.variable_01
    7
    8
    9# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'variable_01'.
                    Did you mean: 'variable_00'?
    
  • I add variable_01 to attribute_error.py

    1# variable_00
    2variable_00 = None
    3variable_01
    

    the terminal is my friend, and shows NameError

    NameError: name 'variable_01' is not defined
    
  • I point it to None to define it

    1# variable_00
    2variable_00 = None
    3# variable_01
    4variable_01 = None
    

    the test passes because variable_01 is now an attribute of attribute_error.py in the src folder, and I can use it from outside the file with src.attribute_error.variable_01.

  • I add a statement for variable_02 to test_attribute_error.py

     4def test_attribute_error_w_variables():
     5    src.attribute_error.variable_00
     6    src.attribute_error.variable_01
     7    src.attribute_error.variable_02
     8
     9
    10# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'variable_02'.
                    Did you mean: 'variable_00'?
    
  • I add variable_02 and point it to None in attribute_error.py

    1# variable_00
    2variable_00 = None
    3# variable_01
    4variable_01 = None
    5variable_02 = None
    

    the test passes because variable_02 is now an attribute of attribute_error.py in the src folder, and I can use it from outside the file with src.attribute_error.variable_02.

  • I add a line for variable_03 to test_attribute_error.py

     4def test_attribute_error_w_variables():
     5    src.attribute_error.variable_00
     6    src.attribute_error.variable_01
     7    src.attribute_error.variable_02
     8    src.attribute_error.variable_03
     9
    10
    11# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'variable_03'.
                    Did you mean: 'variable_00'?
    
  • I add variable_03 to attribute_error.py

    1# variable_00
    2variable_00 = None
    3# variable_01
    4variable_01 = None
    5variable_02 = None
    6variable_03 = None
    

    the test passes because variable_03 is now an attribute of attribute_error.py in the src folder, and I can use it from outside the file with src.attribute_error.variable_03.

  • I add a line for variable_04 to test_attribute_error.py

     4def test_attribute_error_w_variables():
     5    src.attribute_error.variable_00
     6    src.attribute_error.variable_01
     7    src.attribute_error.variable_02
     8    src.attribute_error.variable_03
     9    src.attribute_error.variable_04
    10
    11
    12# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'variable_04'.
                    Did you mean: 'variable_00'?
    
  • I add variable_04 to attribute_error.py

    1# variable_00
    2variable_00 = None
    3# variable_01
    4variable_01 = None
    5variable_02 = None
    6variable_03 = None
    7variable_04 = None
    

    the test passes because variable_04 is now an attribute of attribute_error.py in the src folder, and I can use it from outside the file with src.attribute_error.variable_04.

  • I add a line for variable_05 to test_attribute_error.py

     4def test_attribute_error_w_variables():
     5    src.attribute_error.variable_00
     6    src.attribute_error.variable_01
     7    src.attribute_error.variable_02
     8    src.attribute_error.variable_03
     9    src.attribute_error.variable_04
    10    src.attribute_error.variable_05
    11
    12
    13# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'variable_05'.
                    Did you mean: 'variable_00'?
    
  • I add variable_05 to attribute_error.py

    1# variable_00
    2variable_00 = None
    3# variable_01
    4variable_01 = None
    5variable_02 = None
    6variable_03 = None
    7variable_04 = None
    8variable_05 = variable_04
    

    the test passes because variable_05 is now an attribute of attribute_error.py in the src folder, and I can use it from outside the file with src.attribute_error.variable_05.

  • I add a line for variable_06 to test_attribute_error.py

     4def test_attribute_error_w_variables():
     5    src.attribute_error.variable_00
     6    src.attribute_error.variable_01
     7    src.attribute_error.variable_02
     8    src.attribute_error.variable_03
     9    src.attribute_error.variable_04
    10    src.attribute_error.variable_05
    11    src.attribute_error.variable_06
    12
    13
    14# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'variable_06'.
                    Did you mean: 'variable_00'?
    
  • I add variable_06 to attribute_error.py

    1# variable_00
    2variable_00 = None
    3# variable_01
    4variable_01 = None
    5variable_02 = None
    6variable_03 = None
    7variable_04 = None
    8variable_05 = variable_04
    9variable_06 = variable_05
    

    the test passes because variable_06 is now an attribute of attribute_error.py in the src folder, and I can use it from outside the file with src.attribute_error.variable_06.

  • I add a line for variable_07 to test_attribute_error.py

     4def test_attribute_error_w_variables():
     5    src.attribute_error.variable_00
     6    src.attribute_error.variable_01
     7    src.attribute_error.variable_02
     8    src.attribute_error.variable_03
     9    src.attribute_error.variable_04
    10    src.attribute_error.variable_05
    11    src.attribute_error.variable_06
    12    src.attribute_error.variable_07
    13
    14
    15# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'variable_07'.
                    Did you mean: 'variable_00'?
    
  • I add variable_07 to attribute_error.py

     1# variable_00
     2variable_00 = None
     3# variable_01
     4variable_01 = None
     5variable_02 = None
     6variable_03 = None
     7variable_04 = None
     8variable_05 = variable_04
     9variable_06 = variable_05
    10variable_07 = variable_06
    

    the test passes because variable_07 is now an attribute of attribute_error.py in the src folder, and I can use it from outside the file with src.attribute_error.variable_07.

  • I add a line for variable_08 to test_attribute_error.py

     4def test_attribute_error_w_variables():
     5    src.attribute_error.variable_00
     6    src.attribute_error.variable_01
     7    src.attribute_error.variable_02
     8    src.attribute_error.variable_03
     9    src.attribute_error.variable_04
    10    src.attribute_error.variable_05
    11    src.attribute_error.variable_06
    12    src.attribute_error.variable_07
    13    src.attribute_error.variable_08
    14
    15
    16# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'variable_08'.
                    Did you mean: 'variable_00'?
    
  • I add variable_08 to attribute_error.py

     1# variable_00
     2variable_00 = None
     3# variable_01
     4variable_01 = None
     5variable_02 = None
     6variable_03 = None
     7variable_04 = None
     8variable_05 = variable_04
     9variable_06 = variable_05
    10variable_07 = variable_06
    11variable_08 = variable_07
    

    the test passes because variable_08 is now an attribute of attribute_error.py in the src folder, and I can use it from outside the file with src.attribute_error.variable_08.

  • I add a line for variable_09 to test_attribute_error.py

     4def test_attribute_error_w_variables():
     5    src.attribute_error.variable_00
     6    src.attribute_error.variable_01
     7    src.attribute_error.variable_02
     8    src.attribute_error.variable_03
     9    src.attribute_error.variable_04
    10    src.attribute_error.variable_05
    11    src.attribute_error.variable_06
    12    src.attribute_error.variable_07
    13    src.attribute_error.variable_08
    14    src.attribute_error.variable_09
    15
    16
    17# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'variable_09'.
                    Did you mean: 'variable_00'?
    
  • I add variable_09 to attribute_error.py

     1# variable_00
     2variable_00 = None
     3# variable_01
     4variable_01 = None
     5variable_02 = None
     6variable_03 = None
     7variable_04 = None
     8variable_05 = variable_04
     9variable_06 = variable_05
    10variable_07 = variable_06
    11variable_08 = variable_07
    12variable_09 = variable_08
    

    the test passes because variable_09 is now an attribute of attribute_error.py in the src folder, and I can use it from outside the file with src.attribute_error.variable_09.

  • I remove the commented lines

     1variable_00 = None
     2variable_01 = None
     3variable_02 = None
     4variable_03 = None
     5variable_04 = None
     6variable_05 = variable_04
     7variable_06 = variable_05
     8variable_07 = variable_06
     9variable_08 = variable_07
    10variable_09 = variable_08
    
  • I add a git commit message in the other terminal

    git commit -am \
    'add test_attribute_error_w_variables'
    

A variable in a module is an attribute of the module.


test_attribute_error_w_functions


RED: make it fail


  • I go back to the terminal where the tests are running

I add a test for functions to test_attribute_error.py

15        src.attribute_error.variable_07
16        src.attribute_error.variable_08
17        src.attribute_error.variable_09
18
19    def test_attribute_error_w_functions():
20        src.attribute_error.function_00()
21
22
23# Exceptions seen

the terminal is my friend, and shows AttributeError

AttributeError: module 'src.attribute_error'
                has no attribute 'function_00'

GREEN: make it pass


  • I add the name and point it to None in attribute_error.py

     1variable_00 = None
     2variable_01 = None
     3variable_02 = None
     4variable_03 = None
     5variable_04 = None
     6variable_05 = None
     7variable_06 = None
     8variable_07 = None
     9variable_08 = None
    10variable_09 = None
    11
    12
    13function_00 = None
    

    the terminal is my friend, and shows TypeError

    TypeError: 'NoneType' object is not callable
    

    because I cannot call None like a function.

  • I add TypeError to the list of Exceptions seen in test_attribute_error.py

    23# Exceptions seen
    24# AssertionError
    25# AttributeError
    26# NameError
    27# TypeError
    
  • I change the variable to a function in attribute_error.py

    13# function_00 = None
    14def function_00():
    15    return None
    
    • the test passes because function_00 is now an attribute/property of attribute_error.py in the src folder

    • I can call it from outside the file with src.attribute_error.function_00()


REFACTOR: make it better


  • I remove the commented line

     1variable_00 = None
     2variable_01 = None
     3variable_02 = None
     4variable_03 = None
     5variable_04 = None
     6variable_05 = None
     7variable_06 = None
     8variable_07 = None
     9variable_08 = None
    10variable_09 = None
    11
    12
    13def function_00():
    14    return None
    

    time to make it a drill.

  • I add a call to src.attribute_error.function_01 in test_attribute_error_w_functions in test_attribute_error.py

    19    def test_attribute_error_w_functions():
    20        src.attribute_error.function_00()
    21        src.attribute_error.function_01()
    22
    23
    24# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'function_01'.
                    Did you mean: 'function_00'?
    
  • I add the function to attribute_error.py

    13def function_00():
    14    return None
    15
    16
    17def function_01():
    18    return None
    

    the test passes.

  • I add a line for src.attribute_error.function_02 to test_attribute_error_w_functions in test_attribute_error.py

    13    def test_attribute_error_w_functions():
    14        src.attribute_error.function_00()
    15        src.attribute_error.function_01()
    16        src.attribute_error.function_02()
    17
    18
    19# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'function_02'.
                    Did you mean: 'function_00'?
    
  • I add a function for it in attribute_error.py

    17def function_01():
    18    return None
    19
    20
    21def function_02():
    22    return None
    

    the test passes.

  • I add a line for src.attribute_error.function_03 to test_attribute_error_w_functions in test_attribute_error.py

    19    def test_attribute_error_w_functions():
    20        src.attribute_error.function_00()
    21        src.attribute_error.function_01()
    22        src.attribute_error.function_02()
    23        src.attribute_error.function_03()
    24
    25
    26# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'function_03'.
                    Did you mean: 'function_00'?
    
  • I add a function for it in attribute_error.py

    21def function_02():
    22    return None
    23
    24
    25def function_03():
    26    return None
    

    the test passes.

  • I add a line for src.attribute_error.function_04 to test_attribute_error_w_functions in test_attribute_error.py

    19    def test_attribute_error_w_functions():
    20        src.attribute_error.function_00()
    21        src.attribute_error.function_01()
    22        src.attribute_error.function_02()
    23        src.attribute_error.function_03()
    24        src.attribute_error.function_04()
    25
    26
    27# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'function_04'.
                    Did you mean: 'function_00'?
    
  • I add a function for it in attribute_error.py

    25def function_03():
    26    return None
    27
    28
    29def function_04():
    30    return None
    

    the test passes.

  • I add a line for src.attribute_error.function_05 to test_attribute_error_w_functions in test_attribute_error.py

    19    def test_attribute_error_w_functions():
    20        src.attribute_error.function_00()
    21        src.attribute_error.function_01()
    22        src.attribute_error.function_02()
    23        src.attribute_error.function_03()
    24        src.attribute_error.function_04()
    25        src.attribute_error.function_05()
    26
    27
    28# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'function_05'.
                    Did you mean: 'function_00'?
    
  • I add a function for it in attribute_error.py

    29def function_04():
    30    return None
    31
    32
    33def function_05():
    34    return None
    

    the test passes.

  • I add a line for src.attribute_error.function_06 to test_attribute_error_w_functions in test_attribute_error.py

    19    def test_attribute_error_w_functions():
    20        src.attribute_error.function_00()
    21        src.attribute_error.function_01()
    22        src.attribute_error.function_02()
    23        src.attribute_error.function_03()
    24        src.attribute_error.function_04()
    25        src.attribute_error.function_05()
    26        src.attribute_error.function_06()
    27
    28
    29# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'function_06'.
                    Did you mean: 'function_00'?
    
  • I add a function for it in attribute_error.py

    33def function_05():
    34    return None
    35
    36
    37def function_06():
    38    return None
    

    the test passes.

  • I add a line for src.attribute_error.function_07 to test_attribute_error_w_functions in test_attribute_error.py

    19    def test_attribute_error_w_functions():
    20        src.attribute_error.function_00()
    21        src.attribute_error.function_01()
    22        src.attribute_error.function_02()
    23        src.attribute_error.function_03()
    24        src.attribute_error.function_04()
    25        src.attribute_error.function_05()
    26        src.attribute_error.function_06()
    27        src.attribute_error.function_07()
    28
    29
    30# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'function_07'.
                    Did you mean: 'function_00'?
    
  • I add a function for it in attribute_error.py

    37def function_06():
    38    return None
    39
    40
    41def function_07():
    42    return None
    

    the test passes.

  • I add a line for src.attribute_error.function_08 to test_attribute_error_w_functions in test_attribute_error.py

    19    def test_attribute_error_w_functions():
    20        src.attribute_error.function_00()
    21        src.attribute_error.function_01()
    22        src.attribute_error.function_02()
    23        src.attribute_error.function_03()
    24        src.attribute_error.function_04()
    25        src.attribute_error.function_05()
    26        src.attribute_error.function_06()
    27        src.attribute_error.function_07()
    28        src.attribute_error.function_08()
    29
    30
    31# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'function_08'.
                    Did you mean: 'function_00'?
    
  • I add a function for it in attribute_error.py

    41def function_07():
    42    return None
    43
    44
    45def function_08():
    46    return None
    

    the test passes.

  • I add a line for src.attribute_error.function_09 to test_attribute_error_w_functions in test_attribute_error.py

    19    def test_attribute_error_w_functions():
    20        src.attribute_error.function_00()
    21        src.attribute_error.function_01()
    22        src.attribute_error.function_02()
    23        src.attribute_error.function_03()
    24        src.attribute_error.function_04()
    25        src.attribute_error.function_05()
    26        src.attribute_error.function_06()
    27        src.attribute_error.function_07()
    28        src.attribute_error.function_08()
    29        src.attribute_error.function_09()
    30
    31
    32# Exceptions seen
    

    the terminal is my friend, and shows AttributeError

    AttributeError: module 'src.attribute_error'
                    has no attribute 'function_09'.
                    Did you mean: 'function_00'?
    
  • I add a function for it in attribute_error.py

    45def function_08():
    46    return None
    47
    48
    49def function_09():
    50    return None
    

    the test passes.

  • I add a git commit message in the other terminal

    git commit -am \
    'add test_attribute_error_w_functions'
    
  • A function in a module is an attribute of the module

  • A variable in a module is an attribute of the module


close the project

  • I close attribute_error.py and test_attribute_error.py

  • I click in the terminal where the tests are running

  • I use q on the keyboard to leave the tests. The terminal goes back to the command line.

  • I change directory to the parent of attribute_error

    cd ..
    

    the terminal shows

    .../pumping_python
    

    I am back in the pumping_python directory.


review

I ran tests for AttributeError with

I also saw these Exceptions

My problem with the tests is that they all show the correct way to use attributes I made in attribute_error.py. If someone reads the file or runs it, there is no way for them to know how the code relates to AttributeError unless they go through the process with me, there has to be a better way.


code from the chapter

Do you want to see all the CODE I typed in this chapter?


what is next?

You know

Would you like to test using a class to remove repetition of inputs from functions?


rate pumping python

If this has been a 7 star experience for you, please CLICK HERE to leave a 5 star review of pumping python. It helps other people get into the book too.