github.com/qri-io/qri@v0.10.1-0.20220104210721-c771715036cb/transform/startf/ds/testdata/test.star (about) 1 load('assert.star', 'assert') 2 load('dataset.star', 'dataset') 3 4 ds = dataset.new() 5 6 assert.eq(ds.set_meta("foo", "bar"), None) 7 assert.eq(ds.get_meta(), {"foo": "bar", "qri": "md:0"}) 8 9 10 assert.eq(ds.get_structure(), None) 11 12 st = { 13 'format' : 'json', 14 'schema' : { 'type' : 'array' } 15 } 16 17 exp = { 18 'schema': { 19 'type': 'array' 20 }, 21 'format': 'json', 22 'qri': 'st:0' 23 } 24 25 assert.eq(ds.set_structure(st), None) 26 assert.eq(ds.get_structure(), exp) 27 28 bd = [[10,20,30]] 29 bd_obj = {'a': [10,20,30]} 30 31 # How the body renders a dataframe 32 expect_bd = " 0 1 2\n0 10 20 30" 33 expect_bd_obj = " a\n0 10\n1 20\n2 30" 34 35 ds.body = bd 36 assert.eq('%s' % ds.body, expect_bd) 37 38 ds.body = bd_obj 39 assert.eq('%s' % ds.body, expect_bd_obj)