Lines Matching refs:hf
170 hf = hasfields()
171 assert.eq(dir(hf), [])
172 assert.true(not hasattr(hf, "x"))
173 assert.fails(lambda: getattr(hf, "x"), "no .x field or method")
174 assert.eq(getattr(hf, "x", 42), 42)
175 hf.x = 1
176 assert.true(hasattr(hf, "x"))
177 assert.eq(getattr(hf, "x"), 1)
178 assert.eq(hf.x, 1)
179 hf.x = 2
180 assert.eq(getattr(hf, "x"), 2)
181 assert.eq(hf.x, 2)
197 hf.one = 1
198 hf.two = 2
199 hf.three = 3
200 hf.forty_five = 45
201 assert.fails(lambda: hf.One, 'no .One field.*did you mean .one')
202 assert.fails(lambda: hf.oone, 'no .oone field.*did you mean .one')
203 assert.fails(lambda: hf.FortyFive, 'no .FortyFive field.*did you mean .forty_five')
204 assert.fails(lambda: hf.trhee, 'no .trhee field.*did you mean .three')
205 assert.fails(lambda: hf.thirty, 'no .thirty field or method$') # no suggestion
208 def setfield(): hf.noForty_Five = 46 # "no" prefix => SetField returns NoSuchField