PyTest - Writing Assertions
What will be the outcome of this pytest assertion?
str1 = 'hello' str2 = ''.join(['h', 'e', 'l', 'l', 'o']) assert str1 is str2
str1 = 'hello' str2 = ''.join(['h', 'e', 'l', 'l', 'o']) assert str1 is str2
str2 are usually new objects.is checks object identity, not content equality.str1 and str2 have same content but are different objects, so assert str1 is str2 fails.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions