Hello! I’m new around here and have been learning for about two months, with varying levels of difficulty and success haha.
I’d like some help with the beginning of the ex49 tests. I’ve copied what I have below.
When I run nosetests on what I have, I get the following error:
File "C:\Users\danzi\lpthw\ex48\tests\parser_tests.py", line 10, in test_subject assert s1.object == "pigeon" AttributeError: 'Sentence' object has no attribute 'object'
I have no idea what that means, and have spent several hours trying to make sure I’ve typed in in correctly and looking for answers on codestack and github, but they are all done a different way than Mr. Shaw demonstrates in the videos. I don’t know how I’m getting an attribute error; it looks like everything is correctly assigned. Could you help? Thanks all!
from nose.tools import * from ex48 import lexicon, parser def test_subject(): s1 = parser.Sentence(('noun', "cheese"), ('verb', "eats"), ('noun', "pigeon")) assert s1.verb == "eats" assert s1.subject == "cheese" assert s1.object == "pigeon"
class ParserError(Exception): pass class Sentence(object): def __init__(self, subject, verb, obj): self.subject = subject self.verb = verb self.object = obj