Why am I getting an Assertion Error on this Python code?
<p>I have a function written here:</p>

<pre><code>def addItem(aBookcase, name, mediaType):
    """
    Returns False if aBookcase is full, otherwise returns True and 
    adds item of given name and mediaType to aBookcase.
    """
    pass
    emptySpacesBefore = aBookcase.getEmptySpaces()
    if aBookcase.getEmptySpaces() == 0:
        added = False
        return added
    else:
        position = findSpace(aBookcase)
        aBookcase.setName(*position, name=name)
        aBookcase.setType(*position, mediaType=mediaType)
        added = True
        emptySpacesAfter = aBookcase.getEmptySpaces()
    assert added is True, "No free positions"
    assert emptySpacesAfter &lt; emptySpacesBefore, "Same amount of empty spaces"
    assert aBookcase.getName(*position) is name, "Error with name"
    assert aBookcase.getType(*position) is mediaType, "Error with media type"
</code></pre>

<p>Yet when I go to test the function with this line of code:</p>

<pre><code>assert addItem(small, "Algorhythms, date structures and compatibility", BOOK)
</code></pre>

<p>I get an 'AssertionError' as shown here:</p>

<p><a href="https://i.stack.imgur.com/G15LR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/G15LR.png" alt="Screenshot of &#39;AssertionError&#39;"></a></p>

<p>So if I'm right, it means I'm not handling it but I'm not sure how or why? Is it something wrong with my code? Something missing? etc. </p>