0

I have created an instance on an object

for row in csv_reader:
    temp_case = test_case.TestCase 
    temp_case.file = row[1].strip()
    ...
    test_cases.append(temp_case)
    print(test_cases[0].file)

As you can see, I am appending the instances to a list that I can iterate on in other modules and I am checking what it the first item on the list.

... And I am getting for every iteration a different name, but expecting it to be the same:

test1.py
test2.py
test3.py

BTW, the entire list is of the same instance...

print(test_cases[0].file)
print(test_cases[1].file)
print(test_cases[2].file)

Result with:

test3.py
test3.py
test3.py

1 Answer 1

1

Apparently, the following solves the issue:

temp_case = test_case.TestCase()

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.