Python assertEquals generator -
i'm unit testing generator object contains objects. wanna check objects value property see if contains number, expected.
the generator object contains 5 object instances class test. wanna this:
pseudo code: test instance object's value property (test.value), in generator object (to list) equal [1, 2, 3, 4, 5].
is possible achieve using 1 line loop or inside assertequals method?
since it's 5 elements, use list comprehension.
assertequal([test.value test in test_instance_objects], [1, 2, 3, 4, 5])
Comments
Post a Comment