void () { doTest("Cat", """ from collections import namedtuple Cat = namedtuple("Cat", "name age") expr = Cat("name", 5)._replace(name="newname")"""); doTest("Cat", """ from collections import namedtuple class Cat(namedtuple("Cat", "name age")): pass expr = Cat("name", 5)._replace(name="newname")"""); doTest("str", """ from collections import namedtuple Cat = namedtuple("Cat", "name age") expr = Cat("name", 5)._replace(age="five").age"""); doTest("Cat", """ from collections import namedtuple class Cat(namedtuple("Cat", "name age")): pass expr = Cat._replace(Cat("name", 5), name="newname")"""); }