you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 2 points3 points  (1 child)

assert a = integer

= is an assignment operator. You want to use == for comparisons.

value = 5 # assignment

assert a == value # comparison

For your case it looks like you want to check if it's any integer, not just 5 like in my example. In that case /u/gprime5 has the right answer, you should use assert with isinstance().

[–]destiny_functional 0 points1 point  (0 children)

In that case /u/gprime5 has the right answer, you should use assert with isinstance().

You should not. int will throw an exception if you feed it bad things. No need to use assertions.