github.com/k14s/starlark-go@v0.0.0-20200720175618-3a5c849cc368/starlark/testdata/module.star (about) 1 # Tests of Module. 2 3 load("assert.star", "assert") 4 5 assert.eq(type(assert), "module") 6 assert.eq(str(assert), '<module "assert">') 7 assert.eq(dir(assert), ["contains", "eq", "fail", "fails", "lt", "ne", "true"]) 8 assert.fails(lambda : {assert: None}, "unhashable: module") 9 10 def assignfield(): 11 assert.foo = None 12 13 assert.fails(assignfield, "can't assign to .foo field of module") 14 15 # no such field 16 assert.fails(lambda : assert.nonesuch, "module has no .nonesuch field or method$") 17 assert.fails(lambda : assert.falls, "module has no .falls field or method .did you mean .fails\?")