I was trying to write a code and check it with pytest. I thought I did everything ok, but I got a problem. After writing this, I want to check it with method of class Person. When I tried to use method id the function ends and I got the output:
 TypeError: 'str' object is not callable
My code:
class Person:
    def __init__(self, id, name, sex, birth_date):
        self.name = name
        self.id = id
        self.sex = sex
        self.birth_date = birth_date
    def __str__(self):
        return f'{self.name} born {self.birth_date} with {self.sex} has {self.id}'
    def name(self):
        return self.name
    def sex(self):
        return self.sex
    def id(self):
        return self.id
    def date_of_birth(self):
        return self.birth_date
def read_from_file(file_handle):
        people = []
        reader = csv.DictReader(file_handle)
        for row in reader:
            id = row['id']
            name = row['name']
            sex = row['sex']
            birth_date = row['birth_date']
            person = Person(id, name, sex, birth_date)
            print(person.id())[Error in this line]
            people.append(person)
        return people
def test_files():
    with open('people.txt', 'r') as people_txt:
        people = read_from_file(people_txt)
Example of line of people.txt:
id,name,sex,birth_date
1,Doralyn Dovermann,Female,27/10/2005
2,Rickert Petschel,Male,10/7/2018
3,Whitney Girardoni,Female,7/3/1932
 
    