-1

I'm trying to set global definitions to True, but I'm always getting an error saying "AssertionError: False is not True"

From instructions: 'Only things that are expected to be constant should be defined as globals. That is true for all of these.'

#global definitions
UP = True
DOWN = True
LEFT = True
RIGHT = True
dirs = [UP, DOWN, LEFT, RIGHT]

#a bunch of code follows here

This is the one of the errors (for UP) I've been getting.

self.assertTrue(isinstance(UP,Direction))
AssertionError: False is not true

I have a separate class called Direction created. Furthermore, I have to create an attribute that must be one of Up, Down, Left, and Right but I'm not sure how to do that.

attribute: value::str. Must be one of "UP", "DOWN", "LEFT", or "RIGHT".

#Direction class
class Direction:

    value = dirs
Vincent Luc
  • 79
  • 1
  • 1
  • 5

2 Answers2

1

isInstance() would return true if UP was instance of Direction. But up is not instance of Direction. it is a boolean. Hence, isinstance(UP,Direction) returns false.

Now, you are asserting that it be true. But it is not. Hence the Assertion Error, false is not true.

Samrat Dutta
  • 1,727
  • 1
  • 11
  • 23
1

Change the assertTrue to assertFalse.

Your tests expects to run successful when the return value is False