func (suite *MutationUpdateSuite) TestCases() { suite.T().Log("Running MutationUpdateSuite: Tests updates of selections") tbl := r.DB("test").Table("tbl") _ = tbl // Prevent any noused variable errors tbl2 := r.DB("test").Table("tbl2") _ = tbl2 // Prevent any noused variable errors { // mutation/update.yaml line #6 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':100}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 100} /* tbl.insert([{'id':i} for i in xrange(100)]) */ suite.T().Log("About to run line #6: tbl.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 0; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': i, })\n }\n return res\n}()))") runAndAssert(suite.Suite, expected_, tbl.Insert((func() []interface{} { res := []interface{}{} for iterator_ := 0; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"id": i}) } return res }())), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #6") } { // mutation/update.yaml line #18 /* 100 */ var expected_ int = 100 /* tbl.count() */ suite.T().Log("About to run line #18: tbl.Count()") runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #18") } { // mutation/update.yaml line #21 /* ({'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':100}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 100} /* tbl2.insert([{'id':i, 'foo':{'bar':i}} for i in xrange(100)]) */ suite.T().Log("About to run line #21: tbl2.Insert((func() []interface{} {\n res := []interface{}{}\n for iterator_ := 0; iterator_ < 100; iterator_++ {\n i := iterator_\n res = append(res, map[interface{}]interface{}{'id': i, 'foo': map[interface{}]interface{}{'bar': i, }, })\n }\n return res\n}()))") runAndAssert(suite.Suite, expected_, tbl2.Insert((func() []interface{} { res := []interface{}{} for iterator_ := 0; iterator_ < 100; iterator_++ { i := iterator_ res = append(res, map[interface{}]interface{}{"id": i, "foo": map[interface{}]interface{}{"bar": i}}) } return res }())), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #21") } { // mutation/update.yaml line #33 /* 100 */ var expected_ int = 100 /* tbl2.count() */ suite.T().Log("About to run line #33: tbl2.Count()") runAndAssert(suite.Suite, expected_, tbl2.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #33") } { // mutation/update.yaml line #37 /* {'deleted':0.0,'replaced':0.0,'unchanged':1,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 1, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.get(12).update(lambda row:row) */ suite.T().Log("About to run line #37: tbl.Get(12).Update(func(row r.Term) interface{} { return row})") runAndAssert(suite.Suite, expected_, tbl.Get(12).Update(func(row r.Term) interface{} { return row }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #37") } { // mutation/update.yaml line #43 /* {'deleted':0.0,'replaced':1,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 1, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.get(12).update(lambda row:{'a':row['id'] + 1}, durability='soft') */ suite.T().Log("About to run line #43: tbl.Get(12).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': row.AtIndex('id').Add(1), }}).OptArgs(r.UpdateOpts{Durability: 'soft', })") runAndAssert(suite.Suite, expected_, tbl.Get(12).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": row.AtIndex("id").Add(1)} }).OptArgs(r.UpdateOpts{Durability: "soft"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #43") } { // mutation/update.yaml line #48 /* {'id':12, 'a':13} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 12, "a": 13} /* tbl.get(12) */ suite.T().Log("About to run line #48: tbl.Get(12)") runAndAssert(suite.Suite, expected_, tbl.Get(12), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #48") } { // mutation/update.yaml line #52 /* {'deleted':0.0,'replaced':1,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 1, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.get(12).update(lambda row:{'a':row['id'] + 2}, durability='hard') */ suite.T().Log("About to run line #52: tbl.Get(12).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': row.AtIndex('id').Add(2), }}).OptArgs(r.UpdateOpts{Durability: 'hard', })") runAndAssert(suite.Suite, expected_, tbl.Get(12).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": row.AtIndex("id").Add(2)} }).OptArgs(r.UpdateOpts{Durability: "hard"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #52") } { // mutation/update.yaml line #57 /* {'id':12, 'a':14} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 12, "a": 14} /* tbl.get(12) */ suite.T().Log("About to run line #57: tbl.Get(12)") runAndAssert(suite.Suite, expected_, tbl.Get(12), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #57") } { // mutation/update.yaml line #61 /* err('ReqlQueryLogicError', 'Durability option `wrong` unrecognized (options are "hard" and "soft").', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Durability option `wrong` unrecognized (options are \"hard\" and \"soft\").") /* tbl.get(12).update(lambda row:{'a':row['id'] + 3}, durability='wrong') */ suite.T().Log("About to run line #61: tbl.Get(12).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': row.AtIndex('id').Add(3), }}).OptArgs(r.UpdateOpts{Durability: 'wrong', })") runAndAssert(suite.Suite, expected_, tbl.Get(12).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": row.AtIndex("id").Add(3)} }).OptArgs(r.UpdateOpts{Durability: "wrong"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #61") } { // mutation/update.yaml line #66 /* {'id':12, 'a':14} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 12, "a": 14} /* tbl.get(12) */ suite.T().Log("About to run line #66: tbl.Get(12)") runAndAssert(suite.Suite, expected_, tbl.Get(12), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #66") } { // mutation/update.yaml line #70 /* {'deleted':0.0,'replaced':1,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 1, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.get(12).update(lambda row:{'a':row['id']}) */ suite.T().Log("About to run line #70: tbl.Get(12).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': row.AtIndex('id'), }})") runAndAssert(suite.Suite, expected_, tbl.Get(12).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": row.AtIndex("id")} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #70") } { // mutation/update.yaml line #75 /* {'id':12, 'a':12} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 12, "a": 12} /* tbl.get(12) */ suite.T().Log("About to run line #75: tbl.Get(12)") runAndAssert(suite.Suite, expected_, tbl.Get(12), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #75") } { // mutation/update.yaml line #79 /* {'deleted':0.0,'replaced':1,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 1, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.get(12).update({'a':r.literal()}) */ suite.T().Log("About to run line #79: tbl.Get(12).Update(map[interface{}]interface{}{'a': r.Literal(), })") runAndAssert(suite.Suite, expected_, tbl.Get(12).Update(map[interface{}]interface{}{"a": r.Literal()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #79") } { // mutation/update.yaml line #84 /* {'deleted':0.0,'replaced':10,'unchanged':0,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 10, "unchanged": 0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.between(10, 20).update(lambda row:{'a':row['id']}) */ suite.T().Log("About to run line #84: tbl.Between(10, 20).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': row.AtIndex('id'), }})") runAndAssert(suite.Suite, expected_, tbl.Between(10, 20).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": row.AtIndex("id")} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #84") } { // mutation/update.yaml line #89 /* {'deleted':0.0,'replaced':0.0,'unchanged':10,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 10, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.filter(lambda row:(row['id'] >= 10) & (row['id'] < 20)).update(lambda row:{'a':row['id']}) */ suite.T().Log("About to run line #89: tbl.Filter(func(row r.Term) interface{} { return row.AtIndex('id').Ge(10).And(row.AtIndex('id').Lt(20))}).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': row.AtIndex('id'), }})") runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return row.AtIndex("id").Ge(10).And(row.AtIndex("id").Lt(20)) }).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": row.AtIndex("id")} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #89") } { // mutation/update.yaml line #94 /* {'deleted':0.0,'replaced':10,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 10, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.filter(lambda row:(row['id'] >= 10) & (row['id'] < 20)).update(lambda row:{'b':row['id']}) */ suite.T().Log("About to run line #94: tbl.Filter(func(row r.Term) interface{} { return row.AtIndex('id').Ge(10).And(row.AtIndex('id').Lt(20))}).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{'b': row.AtIndex('id'), }})") runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return row.AtIndex("id").Ge(10).And(row.AtIndex("id").Lt(20)) }).Update(func(row r.Term) interface{} { return map[interface{}]interface{}{"b": row.AtIndex("id")} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #94") } { // mutation/update.yaml line #100 /* {'deleted':0.0,'replaced':10,'unchanged':0,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 10, "unchanged": 0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.between(10, 20).update({'a':r.literal()}) */ suite.T().Log("About to run line #100: tbl.Between(10, 20).Update(map[interface{}]interface{}{'a': r.Literal(), })") runAndAssert(suite.Suite, expected_, tbl.Between(10, 20).Update(map[interface{}]interface{}{"a": r.Literal()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #100") } { // mutation/update.yaml line #104 /* {'first_error':"Primary key `id` cannot be changed (`{\n\t\"id\":\t1\n}` -> `{\n\t\"d\":\t1,\n\t\"id\":\t2\n}`).",'deleted':0.0,'replaced':0.0,'unchanged':0.0,'errors':1,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"first_error": "Primary key `id` cannot be changed (`{\n\t\"id\":\t1\n}` -> `{\n\t\"d\":\t1,\n\t\"id\":\t2\n}`).", "deleted": 0.0, "replaced": 0.0, "unchanged": 0.0, "errors": 1, "skipped": 0.0, "inserted": 0.0} /* tbl.get(1).update({'id':2,'d':1}) */ suite.T().Log("About to run line #104: tbl.Get(1).Update(map[interface{}]interface{}{'id': 2, 'd': 1, })") runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"id": 2, "d": 1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #104") } { // mutation/update.yaml line #108 /* {'deleted':0.0,'replaced':1,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 1, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.get(1).update({'id':r.row['id'],'d':'b'}) */ suite.T().Log("About to run line #108: tbl.Get(1).Update(map[interface{}]interface{}{'id': r.Row.AtIndex('id'), 'd': 'b', })") runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"id": r.Row.AtIndex("id"), "d": "b"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #108") } { // mutation/update.yaml line #114 /* {'deleted':0.0,'replaced':0.0,'unchanged':1,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0.0, "unchanged": 1, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.get(1).update(r.row.merge({'d':'b'})) */ suite.T().Log("About to run line #114: tbl.Get(1).Update(r.Row.Merge(map[interface{}]interface{}{'d': 'b', }))") runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(r.Row.Merge(map[interface{}]interface{}{"d": "b"})), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #114") } { // mutation/update.yaml line #119 /* err('ReqlQueryLogicError', 'Could not prove argument deterministic. Maybe you want to use the non_atomic flag?', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Could not prove argument deterministic. Maybe you want to use the non_atomic flag?") /* tbl.get(1).update({'d':r.js('5')}) */ suite.T().Log("About to run line #119: tbl.Get(1).Update(map[interface{}]interface{}{'d': r.JS('5'), })") runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"d": r.JS("5")}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #119") } { // mutation/update.yaml line #122 /* err('ReqlQueryLogicError', 'Could not prove argument deterministic. Maybe you want to use the non_atomic flag?', [0]) */ var expected_ Err = err("ReqlQueryLogicError", "Could not prove argument deterministic. Maybe you want to use the non_atomic flag?") /* tbl.get(1).update({'d':tbl.nth(0)}) */ suite.T().Log("About to run line #122: tbl.Get(1).Update(map[interface{}]interface{}{'d': tbl.Nth(0), })") runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"d": tbl.Nth(0)}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #122") } { // mutation/update.yaml line #125 /* {'deleted':0.0,'replaced':1,'unchanged':0.0,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 1, "unchanged": 0.0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.get(1).update({'d':r.js('5')}, non_atomic=True) */ suite.T().Log("About to run line #125: tbl.Get(1).Update(map[interface{}]interface{}{'d': r.JS('5'), }).OptArgs(r.UpdateOpts{NonAtomic: true, })") runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"d": r.JS("5")}).OptArgs(r.UpdateOpts{NonAtomic: true}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #125") } { // mutation/update.yaml line #137 /* {'deleted':0.0,'replaced':100,'unchanged':0,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 100, "unchanged": 0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.update(lambda row:{'a':row['id']}) */ suite.T().Log("About to run line #137: tbl.Update(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': row.AtIndex('id'), }})") runAndAssert(suite.Suite, expected_, tbl.Update(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": row.AtIndex("id")} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #137") } { // mutation/update.yaml line #143 /* {'deleted':0.0,'replaced':100,'unchanged':0,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 100, "unchanged": 0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl.update({'a':r.literal()}) */ suite.T().Log("About to run line #143: tbl.Update(map[interface{}]interface{}{'a': r.Literal(), })") runAndAssert(suite.Suite, expected_, tbl.Update(map[interface{}]interface{}{"a": r.Literal()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #143") } { // mutation/update.yaml line #147 /* {'deleted':0.0,'replaced':99,'unchanged':1,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 99, "unchanged": 1, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl2.update({'foo':{'bar':2}}) */ suite.T().Log("About to run line #147: tbl2.Update(map[interface{}]interface{}{'foo': map[interface{}]interface{}{'bar': 2, }, })") runAndAssert(suite.Suite, expected_, tbl2.Update(map[interface{}]interface{}{"foo": map[interface{}]interface{}{"bar": 2}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #147") } { // mutation/update.yaml line #150 /* {'deleted':0.0,'replaced':0,'unchanged':100,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 0, "unchanged": 100, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl2.update({'foo':r.literal({'bar':2})}) */ suite.T().Log("About to run line #150: tbl2.Update(map[interface{}]interface{}{'foo': r.Literal(map[interface{}]interface{}{'bar': 2, }), })") runAndAssert(suite.Suite, expected_, tbl2.Update(map[interface{}]interface{}{"foo": r.Literal(map[interface{}]interface{}{"bar": 2})}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #150") } { // mutation/update.yaml line #156 /* {'id':0,'foo':{'bar':2}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "foo": map[interface{}]interface{}{"bar": 2}} /* tbl2.order_by('id').nth(0) */ suite.T().Log("About to run line #156: tbl2.OrderBy('id').Nth(0)") runAndAssert(suite.Suite, expected_, tbl2.OrderBy("id").Nth(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #156") } { // mutation/update.yaml line #159 /* {'deleted':0.0,'replaced':100,'unchanged':0,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 100, "unchanged": 0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl2.update({'foo':{'buzz':2}}) */ suite.T().Log("About to run line #159: tbl2.Update(map[interface{}]interface{}{'foo': map[interface{}]interface{}{'buzz': 2, }, })") runAndAssert(suite.Suite, expected_, tbl2.Update(map[interface{}]interface{}{"foo": map[interface{}]interface{}{"buzz": 2}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #159") } { // mutation/update.yaml line #162 /* {'id':0,'foo':{'bar':2,'buzz':2}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "foo": map[interface{}]interface{}{"bar": 2, "buzz": 2}} /* tbl2.order_by('id').nth(0) */ suite.T().Log("About to run line #162: tbl2.OrderBy('id').Nth(0)") runAndAssert(suite.Suite, expected_, tbl2.OrderBy("id").Nth(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #162") } { // mutation/update.yaml line #165 /* {'deleted':0.0,'replaced':100,'unchanged':0,'errors':0.0,'skipped':0.0,'inserted':0.0} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0.0, "replaced": 100, "unchanged": 0, "errors": 0.0, "skipped": 0.0, "inserted": 0.0} /* tbl2.update({'foo':r.literal(1)}) */ suite.T().Log("About to run line #165: tbl2.Update(map[interface{}]interface{}{'foo': r.Literal(1), })") runAndAssert(suite.Suite, expected_, tbl2.Update(map[interface{}]interface{}{"foo": r.Literal(1)}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #165") } { // mutation/update.yaml line #168 /* {'id':0,'foo':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "foo": 1} /* tbl2.order_by('id').nth(0) */ suite.T().Log("About to run line #168: tbl2.OrderBy('id').Nth(0)") runAndAssert(suite.Suite, expected_, tbl2.OrderBy("id").Nth(0), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #168") } }
func (suite *TransformObjectSuite) TestCases() { suite.T().Log("Running TransformObjectSuite: Tests manipulation operations on objects") // transform/object.yaml line #5 // obj = r.expr({'a':1, 'b':2,'c':"str",'d':null,'e':{'f':'buzz'}}) suite.T().Log("Possibly executing: var obj r.Term = r.Expr(map[interface{}]interface{}{'a': 1, 'b': 2, 'c': 'str', 'd': nil, 'e': map[interface{}]interface{}{'f': 'buzz', }, })") obj := r.Expr(map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "buzz"}}) _ = obj // Prevent any noused variable errors { // transform/object.yaml line #9 /* 1 */ var expected_ int = 1 /* obj['a'] */ suite.T().Log("About to run line #9: obj.AtIndex('a')") runAndAssert(suite.Suite, expected_, obj.AtIndex("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #9") } { // transform/object.yaml line #14 /* 'str' */ var expected_ string = "str" /* obj['c'] */ suite.T().Log("About to run line #14: obj.AtIndex('c')") runAndAssert(suite.Suite, expected_, obj.AtIndex("c"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #14") } { // transform/object.yaml line #22 /* true */ var expected_ bool = true /* obj.has_fields('b') */ suite.T().Log("About to run line #22: obj.HasFields('b')") runAndAssert(suite.Suite, expected_, obj.HasFields("b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #22") } { // transform/object.yaml line #24 /* true */ var expected_ bool = true /* obj.keys().contains('d') */ suite.T().Log("About to run line #24: obj.Keys().Contains('d')") runAndAssert(suite.Suite, expected_, obj.Keys().Contains("d"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #24") } { // transform/object.yaml line #26 /* false */ var expected_ bool = false /* obj.has_fields('d') */ suite.T().Log("About to run line #26: obj.HasFields('d')") runAndAssert(suite.Suite, expected_, obj.HasFields("d"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #26") } { // transform/object.yaml line #28 /* true */ var expected_ bool = true /* obj.has_fields({'e':'f'}) */ suite.T().Log("About to run line #28: obj.HasFields(map[interface{}]interface{}{'e': 'f', })") runAndAssert(suite.Suite, expected_, obj.HasFields(map[interface{}]interface{}{"e": "f"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #28") } { // transform/object.yaml line #30 /* false */ var expected_ bool = false /* obj.has_fields({'e':'g'}) */ suite.T().Log("About to run line #30: obj.HasFields(map[interface{}]interface{}{'e': 'g', })") runAndAssert(suite.Suite, expected_, obj.HasFields(map[interface{}]interface{}{"e": "g"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #30") } { // transform/object.yaml line #32 /* false */ var expected_ bool = false /* obj.has_fields('f') */ suite.T().Log("About to run line #32: obj.HasFields('f')") runAndAssert(suite.Suite, expected_, obj.HasFields("f"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #32") } { // transform/object.yaml line #36 /* true */ var expected_ bool = true /* obj.has_fields('a', 'b') */ suite.T().Log("About to run line #36: obj.HasFields('a', 'b')") runAndAssert(suite.Suite, expected_, obj.HasFields("a", "b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #36") } { // transform/object.yaml line #38 /* false */ var expected_ bool = false /* obj.has_fields('a', 'd') */ suite.T().Log("About to run line #38: obj.HasFields('a', 'd')") runAndAssert(suite.Suite, expected_, obj.HasFields("a", "d"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #38") } { // transform/object.yaml line #40 /* false */ var expected_ bool = false /* obj.has_fields('a', 'f') */ suite.T().Log("About to run line #40: obj.HasFields('a', 'f')") runAndAssert(suite.Suite, expected_, obj.HasFields("a", "f"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #40") } { // transform/object.yaml line #42 /* true */ var expected_ bool = true /* obj.has_fields('a', {'e':'f'}) */ suite.T().Log("About to run line #42: obj.HasFields('a', map[interface{}]interface{}{'e': 'f', })") runAndAssert(suite.Suite, expected_, obj.HasFields("a", map[interface{}]interface{}{"e": "f"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #42") } { // transform/object.yaml line #46 /* 2 */ var expected_ int = 2 /* r.expr([obj, obj.pluck('a', 'b')]).has_fields('a', 'b').count() */ suite.T().Log("About to run line #46: r.Expr([]interface{}{obj, obj.Pluck('a', 'b')}).HasFields('a', 'b').Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{obj, obj.Pluck("a", "b")}).HasFields("a", "b").Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #46") } { // transform/object.yaml line #48 /* 1 */ var expected_ int = 1 /* r.expr([obj, obj.pluck('a', 'b')]).has_fields('a', 'c').count() */ suite.T().Log("About to run line #48: r.Expr([]interface{}{obj, obj.Pluck('a', 'b')}).HasFields('a', 'c').Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{obj, obj.Pluck("a", "b")}).HasFields("a", "c").Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #48") } { // transform/object.yaml line #50 /* 2 */ var expected_ int = 2 /* r.expr([obj, obj.pluck('a', 'e')]).has_fields('a', {'e':'f'}).count() */ suite.T().Log("About to run line #50: r.Expr([]interface{}{obj, obj.Pluck('a', 'e')}).HasFields('a', map[interface{}]interface{}{'e': 'f', }).Count()") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{obj, obj.Pluck("a", "e")}).HasFields("a", map[interface{}]interface{}{"e": "f"}).Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #50") } { // transform/object.yaml line #55 /* {'a':1} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1} /* obj.pluck('a') */ suite.T().Log("About to run line #55: obj.Pluck('a')") runAndAssert(suite.Suite, expected_, obj.Pluck("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #55") } { // transform/object.yaml line #57 /* {'a':1, 'b':2} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2} /* obj.pluck('a', 'b') */ suite.T().Log("About to run line #57: obj.Pluck('a', 'b')") runAndAssert(suite.Suite, expected_, obj.Pluck("a", "b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #57") } { // transform/object.yaml line #62 /* {'b':2, 'c':'str', 'd':null, 'e':{'f':'buzz'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "buzz"}} /* obj.without('a') */ suite.T().Log("About to run line #62: obj.Without('a')") runAndAssert(suite.Suite, expected_, obj.Without("a"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #62") } { // transform/object.yaml line #64 /* {'c':'str', 'd':null,'e':{'f':'buzz'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "buzz"}} /* obj.without('a', 'b') */ suite.T().Log("About to run line #64: obj.Without('a', 'b')") runAndAssert(suite.Suite, expected_, obj.Without("a", "b"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #64") } { // transform/object.yaml line #66 /* {'e':{'f':'buzz'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"e": map[interface{}]interface{}{"f": "buzz"}} /* obj.without('a', 'b', 'c', 'd') */ suite.T().Log("About to run line #66: obj.Without('a', 'b', 'c', 'd')") runAndAssert(suite.Suite, expected_, obj.Without("a", "b", "c", "d"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #66") } { // transform/object.yaml line #68 /* {'a':1, 'b':2, 'c':'str', 'd':null, 'e':{}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{}} /* obj.without({'e':'f'}) */ suite.T().Log("About to run line #68: obj.Without(map[interface{}]interface{}{'e': 'f', })") runAndAssert(suite.Suite, expected_, obj.Without(map[interface{}]interface{}{"e": "f"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #68") } { // transform/object.yaml line #70 /* {'a':1, 'b':2, 'c':'str', 'd':null, 'e':{'f':'buzz'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "buzz"}} /* obj.without({'e':'buzz'}) */ suite.T().Log("About to run line #70: obj.Without(map[interface{}]interface{}{'e': 'buzz', })") runAndAssert(suite.Suite, expected_, obj.Without(map[interface{}]interface{}{"e": "buzz"}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #70") } { // transform/object.yaml line #77 /* 1 */ var expected_ int = 1 /* obj.merge(1) */ suite.T().Log("About to run line #77: obj.Merge(1)") runAndAssert(suite.Suite, expected_, obj.Merge(1), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #77") } { // transform/object.yaml line #81 /* {'a':1, 'b':2, 'c':'str', 'd':null, 'e':-2} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": -2} /* obj.merge({'e':-2}) */ suite.T().Log("About to run line #81: obj.Merge(map[interface{}]interface{}{'e': -2, })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"e": -2}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #81") } { // transform/object.yaml line #85 /* {'a':1, 'b':2, 'c':'str', 'd':null} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil} /* obj.merge({'e':r.literal()}) */ suite.T().Log("About to run line #85: obj.Merge(map[interface{}]interface{}{'e': r.Literal(), })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"e": r.Literal()}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #85") } { // transform/object.yaml line #89 /* {'a':1, 'b':2, 'c':'str', 'd':null, 'e':{'f':'quux'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "quux"}} /* obj.merge({'e':{'f':'quux'}}) */ suite.T().Log("About to run line #89: obj.Merge(map[interface{}]interface{}{'e': map[interface{}]interface{}{'f': 'quux', }, })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"e": map[interface{}]interface{}{"f": "quux"}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #89") } { // transform/object.yaml line #92 /* {'a':1, 'b':2, 'c':'str', 'd':null, 'e':{'f':'buzz', 'g':'quux'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "buzz", "g": "quux"}} /* obj.merge({'e':{'g':'quux'}}) */ suite.T().Log("About to run line #92: obj.Merge(map[interface{}]interface{}{'e': map[interface{}]interface{}{'g': 'quux', }, })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"e": map[interface{}]interface{}{"g": "quux"}}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #92") } { // transform/object.yaml line #95 /* {'a':1, 'b':2, 'c':'str', 'd':null, 'e':{'g':'quux'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"g": "quux"}} /* obj.merge({'e':r.literal({'g':'quux'})}) */ suite.T().Log("About to run line #95: obj.Merge(map[interface{}]interface{}{'e': r.Literal(map[interface{}]interface{}{'g': 'quux', }), })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"e": r.Literal(map[interface{}]interface{}{"g": "quux"})}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #95") } { // transform/object.yaml line #99 /* {'a':-1, 'b':2, 'c':'str', 'd':null, 'e':{'f':'buzz'}} */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": -1, "b": 2, "c": "str", "d": nil, "e": map[interface{}]interface{}{"f": "buzz"}} /* obj.merge({'a':-1}) */ suite.T().Log("About to run line #99: obj.Merge(map[interface{}]interface{}{'a': -1, })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"a": -1}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #99") } // transform/object.yaml line #102 // errmsg = 'Stray literal keyword found:'+' literal is only legal inside of the object passed to merge or update and cannot nest inside other literals.' suite.T().Log("Possibly executing: var errmsg string = 'Stray literal keyword found:' + ' literal is only legal inside of the object passed to merge or update and cannot nest inside other literals.'") errmsg := "Stray literal keyword found:" + " literal is only legal inside of the object passed to merge or update and cannot nest inside other literals." _ = errmsg // Prevent any noused variable errors { // transform/object.yaml line #105 /* err("ReqlQueryLogicError", errmsg, []) */ var expected_ Err = err("ReqlQueryLogicError", errmsg) /* r.literal('foo') */ suite.T().Log("About to run line #105: r.Literal('foo')") runAndAssert(suite.Suite, expected_, r.Literal("foo"), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #105") } { // transform/object.yaml line #108 /* err("ReqlQueryLogicError", errmsg, []) */ var expected_ Err = err("ReqlQueryLogicError", errmsg) /* obj.merge(r.literal('foo')) */ suite.T().Log("About to run line #108: obj.Merge(r.Literal('foo'))") runAndAssert(suite.Suite, expected_, obj.Merge(r.Literal("foo")), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #108") } { // transform/object.yaml line #111 /* err("ReqlQueryLogicError", errmsg, []) */ var expected_ Err = err("ReqlQueryLogicError", errmsg) /* obj.merge({'foo':r.literal(r.literal('foo'))}) */ suite.T().Log("About to run line #111: obj.Merge(map[interface{}]interface{}{'foo': r.Literal(r.Literal('foo')), })") runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"foo": r.Literal(r.Literal("foo"))}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #111") } // transform/object.yaml line #114 // o = r.expr({'a':{'b':1, 'c':2}, 'd':3}) suite.T().Log("Possibly executing: var o r.Term = r.Expr(map[interface{}]interface{}{'a': map[interface{}]interface{}{'b': 1, 'c': 2, }, 'd': 3, })") o := r.Expr(map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 1, "c": 2}, "d": 3}) _ = o // Prevent any noused variable errors { // transform/object.yaml line #116 /* ({'a':{'b':1, 'c':2}, 'd':3, 'e':4, 'f':5}) */ var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 1, "c": 2}, "d": 3, "e": 4, "f": 5} /* o.merge({'e':4}, {'f':5}) */ suite.T().Log("About to run line #116: o.Merge(map[interface{}]interface{}{'e': 4, }, map[interface{}]interface{}{'f': 5, })") runAndAssert(suite.Suite, expected_, o.Merge(map[interface{}]interface{}{"e": 4}, map[interface{}]interface{}{"f": 5}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #116") } { // transform/object.yaml line #120 /* ([{'a':{'b':1, 'c':2}, 'd':3, 'e':3}, {'a':{'b':1, 'c':2}, 'd':4, 'e':4}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 1, "c": 2}, "d": 3, "e": 3}, map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 1, "c": 2}, "d": 4, "e": 4}} /* r.expr([o, o.merge({'d':4})]).merge(lambda row:{'e':row['d']}) */ suite.T().Log("About to run line #120: r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{'d': 4, })}).Merge(func(row r.Term) interface{} { return map[interface{}]interface{}{'e': row.AtIndex('d'), }})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{"d": 4})}).Merge(func(row r.Term) interface{} { return map[interface{}]interface{}{"e": row.AtIndex("d")} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #120") } { // transform/object.yaml line #124 /* ([{'a':{'b':1, 'c':2}, 'd':3, 'e':3}, {'a':{'b':1, 'c':2}, 'd':4, 'e':4}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 1, "c": 2}, "d": 3, "e": 3}, map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 1, "c": 2}, "d": 4, "e": 4}} /* r.expr([o, o.merge({'d':4})]).merge({'e':r.row['d']}) */ suite.T().Log("About to run line #124: r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{'d': 4, })}).Merge(map[interface{}]interface{}{'e': r.Row.AtIndex('d'), })") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{"d": 4})}).Merge(map[interface{}]interface{}{"e": r.Row.AtIndex("d")}), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #124") } { // transform/object.yaml line #129 /* ([{'a':{'b':2, 'c':2}, 'd':3}, {'a':{'b':2, 'c':2}, 'd':4}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 2, "c": 2}, "d": 3}, map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 2, "c": 2}, "d": 4}} /* r.expr([o, o.merge({'d':4})]).merge(lambda row:{'a':{'b':2}}) */ suite.T().Log("About to run line #129: r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{'d': 4, })}).Merge(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': map[interface{}]interface{}{'b': 2, }, }})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{"d": 4})}).Merge(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 2}} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #129") } { // transform/object.yaml line #134 /* ([{'a':{'b':2}, 'd':3}, {'a':{'b':2}, 'd':4}]) */ var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 2}, "d": 3}, map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": 2}, "d": 4}} /* r.expr([o, o.merge({'d':4})]).merge(lambda row:{'a':r.literal({'b':2})}) */ suite.T().Log("About to run line #134: r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{'d': 4, })}).Merge(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': r.Literal(map[interface{}]interface{}{'b': 2, }), }})") runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{o, o.Merge(map[interface{}]interface{}{"d": 4})}).Merge(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": r.Literal(map[interface{}]interface{}{"b": 2})} }), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #134") } { // transform/object.yaml line #139 /* (['a', 'b', 'c', 'd', 'e']) */ var expected_ []interface{} = []interface{}{"a", "b", "c", "d", "e"} /* obj.keys() */ suite.T().Log("About to run line #139: obj.Keys()") runAndAssert(suite.Suite, expected_, obj.Keys(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #139") } { // transform/object.yaml line #142 /* ([1, 2, 'str', null, {'f':'buzz'}]) */ var expected_ []interface{} = []interface{}{1, 2, "str", nil, map[interface{}]interface{}{"f": "buzz"}} /* obj.values() */ suite.T().Log("About to run line #142: obj.Values()") runAndAssert(suite.Suite, expected_, obj.Values(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #142") } { // transform/object.yaml line #146 /* 5 */ var expected_ int = 5 /* obj.count() */ suite.T().Log("About to run line #146: obj.Count()") runAndAssert(suite.Suite, expected_, obj.Count(), suite.session, r.RunOpts{ GeometryFormat: "raw", GroupFormat: "map", }) suite.T().Log("Finished running line #146") } }