func (suite *TransformUnorderedMapSuite) SetupTest() {
	suite.T().Log("Setting up TransformUnorderedMapSuite")
	// Use imports to prevent errors
	_ = time.Time{}
	_ = compare.AnythingIsFine

	session, err := r.Connect(r.ConnectOpts{
		Address: url,
	})
	suite.Require().NoError(err, "Error returned when connecting to server")
	suite.session = session

	r.DBDrop("test").Exec(suite.session)
	err = r.DBCreate("test").Exec(suite.session)
	suite.Require().NoError(err)
	err = r.DB("test").Wait().Exec(suite.session)
	suite.Require().NoError(err)

	r.DB("test").TableDrop("even").Exec(suite.session)
	err = r.DB("test").TableCreate("even").Exec(suite.session)
	suite.Require().NoError(err)
	err = r.DB("test").Table("even").Wait().Exec(suite.session)
	suite.Require().NoError(err)
	r.DB("test").TableDrop("odd").Exec(suite.session)
	err = r.DB("test").TableCreate("odd").Exec(suite.session)
	suite.Require().NoError(err)
	err = r.DB("test").Table("odd").Wait().Exec(suite.session)
	suite.Require().NoError(err)
	r.DB("test").TableDrop("odd2").Exec(suite.session)
	err = r.DB("test").TableCreate("odd2").Exec(suite.session)
	suite.Require().NoError(err)
	err = r.DB("test").Table("odd2").Wait().Exec(suite.session)
	suite.Require().NoError(err)
}
func (suite *MutationAtomicGetSetSuite) TearDownSuite() {
	suite.T().Log("Tearing down MutationAtomicGetSetSuite")

	if suite.session != nil {
		r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session)
		r.DB("test").TableDrop("tbl").Exec(suite.session)
		r.DBDrop("test").Exec(suite.session)

		suite.session.Close()
	}
}
func (suite *ChangefeedsIncludeStatesSuite) TearDownSuite() {
	suite.T().Log("Tearing down ChangefeedsIncludeStatesSuite")

	if suite.session != nil {
		r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session)
		r.DB("test").TableDrop("tbl").Exec(suite.session)
		r.DBDrop("test").Exec(suite.session)

		suite.session.Close()
	}
}
Exemplo n.º 4
0
func (suite *PolymorphismSuite) TearDownSuite() {
	suite.T().Log("Tearing down PolymorphismSuite")

	if suite.session != nil {
		r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session)
		r.DB("test").TableDrop("tbl").Exec(suite.session)
		r.DBDrop("test").Exec(suite.session)

		suite.session.Close()
	}
}
func (suite *SindexNullsinstringsSuite) TearDownSuite() {
	suite.T().Log("Tearing down SindexNullsinstringsSuite")

	if suite.session != nil {
		r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session)
		r.DB("test").TableDrop("tbl").Exec(suite.session)
		r.DBDrop("test").Exec(suite.session)

		suite.session.Close()
	}
}
func (suite *TransformUnorderedMapSuite) TearDownSuite() {
	suite.T().Log("Tearing down TransformUnorderedMapSuite")

	if suite.session != nil {
		r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session)
		r.DB("test").TableDrop("even").Exec(suite.session)
		r.DB("test").TableDrop("odd").Exec(suite.session)
		r.DB("test").TableDrop("odd2").Exec(suite.session)
		r.DBDrop("test").Exec(suite.session)

		suite.session.Close()
	}
}
Exemplo n.º 7
0
func createDBAndTables() {
	r.DBCreate("SpottedWays").Run(Sess)
	r.DB("SpottedWays").TableCreate("users").Run(Sess)
	r.DB("SpottedWays").TableCreate("places").Run(Sess)
	r.DB("SpottedWays").TableCreate("posts").Run(Sess)
	r.DB("SpottedWays").TableCreate("likes").Run(Sess)
	r.DB("SpottedWays").TableCreate("talks").Run(Sess)
	r.DB("SpottedWays").TableCreate("matchs").Run(Sess)
	r.DB("SpottedWays").TableCreate("notifications").Run(Sess)
	r.DB("SpottedWays").TableCreate("history").Run(Sess)
	r.DB("SpottedWays").TableCreate("messages").Run(Sess)
}
Exemplo n.º 8
0
func createDbAndTables() {

	//On creer la db Todolist si elle n'existe pas. (si elle existe deja, rien n'est fait)
	r.DBCreate("Todolist").Run(session)

	//On creer la table Todos si elle n'existe pas dans la db Todolist (si elle existe deja, rien n'est fait)
	r.DB("Todolist").TableCreate("Todos").Run(session)
}
func (suite *MathLogicLogicSuite) TearDownSuite() {
	suite.T().Log("Tearing down MathLogicLogicSuite")

	if suite.session != nil {
		r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session)
		r.DBDrop("test").Exec(suite.session)

		suite.session.Close()
	}
}
func (suite *GeoIntersectionInclusionSuite) TearDownSuite() {
	suite.T().Log("Tearing down GeoIntersectionInclusionSuite")

	if suite.session != nil {
		r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session)
		r.DBDrop("test").Exec(suite.session)

		suite.session.Close()
	}
}
Exemplo n.º 11
0
func consulta(id int) {
	res, err := r.DB("test").Table("prueba").Get(id).Run(conn)
	if err != nil {
		fmt.Println("no hay datos")
	}
	fmt.Println("hay muchos datos")
	res.One(&row)
	if res.Err() != nil {
	}
	defer res.Close()
}
Exemplo n.º 12
0
func (m DefaultManager) initdb() {
	// create tables if needed
	tables := []string{tblNameConfig, tblNameEvents, tblNameAccounts, tblNameRoles, tblNameConsole, tblNameServiceKeys, tblNameRegistries, tblNameExtensions, tblNameWebhookKeys}
	for _, tbl := range tables {
		_, err := r.Table(tbl).Run(m.session)
		if err != nil {
			if _, err := r.DB(m.database).TableCreate(tbl).Run(m.session); err != nil {
				log.Fatalf("error creating table: %s", err)
			}
		}
	}
}
Exemplo n.º 13
0
func (suite *MetaCompositeSuite) TestCases() {
	suite.T().Log("Running MetaCompositeSuite: Tests meta operations in composite queries")

	{
		// meta/composite.py.yaml line #4
		/* ({'dbs_created':3,'config_changes':arrlen(3)}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"dbs_created": 3, "config_changes": arrlen(3)}
		/* r.expr([1,2,3]).for_each(r.db_create('db_' + r.row.coerce_to('string'))) */

		suite.T().Log("About to run line #4: r.Expr([]interface{}{1, 2, 3}).ForEach(r.DBCreate(r.Add('db_', r.Row.CoerceTo('string'))))")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2, 3}).ForEach(r.DBCreate(r.Add("db_", r.Row.CoerceTo("string")))), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #4")
	}

	{
		// meta/composite.py.yaml line #8
		/* partial({'tables_created':9}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 9})
		/* r.db_list().set_difference(["rethinkdb", "test"]).for_each(lambda db_name:
		r.expr([1,2,3]).for_each(lambda i:
		r.db(db_name).table_create('tbl_' + i.coerce_to('string')))) */

		suite.T().Log("About to run line #8: r.DBList().SetDifference([]interface{}{'rethinkdb', 'test'}).ForEach(func(db_name r.Term) interface{} { return r.Expr([]interface{}{1, 2, 3}).ForEach(func(i r.Term) interface{} { return r.DB(db_name).TableCreate(r.Add('tbl_', i.CoerceTo('string')))})})")

		runAndAssert(suite.Suite, expected_, r.DBList().SetDifference([]interface{}{"rethinkdb", "test"}).ForEach(func(db_name r.Term) interface{} {
			return r.Expr([]interface{}{1, 2, 3}).ForEach(func(i r.Term) interface{} { return r.DB(db_name).TableCreate(r.Add("tbl_", i.CoerceTo("string"))) })
		}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #8")
	}

	{
		// meta/composite.py.yaml line #13
		/* partial({'dbs_dropped':3,'tables_dropped':9}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_dropped": 3, "tables_dropped": 9})
		/* r.db_list().set_difference(["rethinkdb", "test"]).for_each(r.db_drop(r.row)) */

		suite.T().Log("About to run line #13: r.DBList().SetDifference([]interface{}{'rethinkdb', 'test'}).ForEach(r.DBDrop(r.Row))")

		runAndAssert(suite.Suite, expected_, r.DBList().SetDifference([]interface{}{"rethinkdb", "test"}).ForEach(r.DBDrop(r.Row)), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #13")
	}
}
Exemplo n.º 14
0
func max() int {
	res, err := r.DB("test").Table("prueba").Max().Run(conn)
	if err != nil {
		fmt.Println("no hay datos")
		return 1
	}
	fmt.Println("hay muchos datos")
	var row map[string]interface{}
	res.One(&row)
	max := row["id"].(float64)
	b := int(max)
	b++
	return b
}
Exemplo n.º 15
0
func (suite *JoinsSuite) TearDownSuite() {
	suite.T().Log("Tearing down JoinsSuite")

	if suite.session != nil {
		r.DB("rethinkdb").Table("_debug_scratch").Delete().Exec(suite.session)
		r.DB("test").TableDrop("messages").Exec(suite.session)
		r.DB("test").TableDrop("otbl").Exec(suite.session)
		r.DB("test").TableDrop("otbl2").Exec(suite.session)
		r.DB("test").TableDrop("receivers").Exec(suite.session)
		r.DB("test").TableDrop("senders").Exec(suite.session)
		r.DB("test").TableDrop("tbl").Exec(suite.session)
		r.DB("test").TableDrop("tbl2").Exec(suite.session)
		r.DBDrop("test").Exec(suite.session)

		suite.session.Close()
	}
}
func (suite *ChangefeedsIncludeStatesSuite) SetupTest() {
	suite.T().Log("Setting up ChangefeedsIncludeStatesSuite")
	// Use imports to prevent errors
	_ = time.Time{}
	_ = compare.AnythingIsFine

	session, err := r.Connect(r.ConnectOpts{
		Address: url,
	})
	suite.Require().NoError(err, "Error returned when connecting to server")
	suite.session = session

	r.DBDrop("test").Exec(suite.session)
	err = r.DBCreate("test").Exec(suite.session)
	suite.Require().NoError(err)
	err = r.DB("test").Wait().Exec(suite.session)
	suite.Require().NoError(err)

	r.DB("test").TableDrop("tbl").Exec(suite.session)
	err = r.DB("test").TableCreate("tbl").Exec(suite.session)
	suite.Require().NoError(err)
	err = r.DB("test").Table("tbl").Wait().Exec(suite.session)
	suite.Require().NoError(err)
}
func (suite *MathLogicFloorCeilRoundSuite) SetupTest() {
	suite.T().Log("Setting up MathLogicFloorCeilRoundSuite")
	// Use imports to prevent errors
	_ = time.Time{}
	_ = compare.AnythingIsFine

	session, err := r.Connect(r.ConnectOpts{
		Address: url,
	})
	suite.Require().NoError(err, "Error returned when connecting to server")
	suite.session = session

	r.DBDrop("test").Exec(suite.session)
	err = r.DBCreate("test").Exec(suite.session)
	suite.Require().NoError(err)
	err = r.DB("test").Wait().Exec(suite.session)
	suite.Require().NoError(err)

}
func (suite *TransformUnorderedMapSuite) TestCases() {
	suite.T().Log("Running TransformUnorderedMapSuite: Tests for ordered_union")

	even := r.DB("test").Table("even")
	_ = even // Prevent any noused variable errors
	odd := r.DB("test").Table("odd")
	_ = odd // Prevent any noused variable errors
	odd2 := r.DB("test").Table("odd2")
	_ = odd2 // Prevent any noused variable errors

	{
		// transform/unordered_map.yaml line #6
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* odd.insert([{"id":1, "num":1}, {"id":3, "num":3}, {"id":5, "num":5}]) */

		suite.T().Log("About to run line #6: odd.Insert([]interface{}{map[interface{}]interface{}{'id': 1, 'num': 1, }, map[interface{}]interface{}{'id': 3, 'num': 3, }, map[interface{}]interface{}{'id': 5, 'num': 5, }})")

		runAndAssert(suite.Suite, expected_, odd.Insert([]interface{}{map[interface{}]interface{}{"id": 1, "num": 1}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 5, "num": 5}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #6")
	}

	{
		// transform/unordered_map.yaml line #7
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* even.insert([{"id":2, "num":2}, {"id":4, "num":4}, {"id":6, "num":6}]) */

		suite.T().Log("About to run line #7: even.Insert([]interface{}{map[interface{}]interface{}{'id': 2, 'num': 2, }, map[interface{}]interface{}{'id': 4, 'num': 4, }, map[interface{}]interface{}{'id': 6, 'num': 6, }})")

		runAndAssert(suite.Suite, expected_, even.Insert([]interface{}{map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 6, "num": 6}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #7")
	}

	{
		// transform/unordered_map.yaml line #8
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* odd2.insert([{"id":7, "num":1}, {"id":8, "num":3}, {"id":9, "num":2}]) */

		suite.T().Log("About to run line #8: odd2.Insert([]interface{}{map[interface{}]interface{}{'id': 7, 'num': 1, }, map[interface{}]interface{}{'id': 8, 'num': 3, }, map[interface{}]interface{}{'id': 9, 'num': 2, }})")

		runAndAssert(suite.Suite, expected_, odd2.Insert([]interface{}{map[interface{}]interface{}{"id": 7, "num": 1}, map[interface{}]interface{}{"id": 8, "num": 3}, map[interface{}]interface{}{"id": 9, "num": 2}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #8")
	}

	{
		// transform/unordered_map.yaml line #11
		/* [{"id":1, "num":1}, {"id":3, "num":3}, {"id":5, "num":5}, {"id":2, "num":2}, {"id":4, "num":4}, {"id":6, "num":6}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 1, "num": 1}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 5, "num": 5}, map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 6, "num": 6}}
		/* odd.order_by("num").union(even.order_by("num"), interleave = false) */

		suite.T().Log("About to run line #11: odd.OrderBy('num').Union(even.OrderBy('num')).OptArgs(r.UnionOpts{Interleave: false, })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num").Union(even.OrderBy("num")).OptArgs(r.UnionOpts{Interleave: false}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #11")
	}

	{
		// transform/unordered_map.yaml line #16
		/* [{"id":2, "num":2}, {"id":4, "num":4}, {"id":6, "num":6}, {"id":1, "num":1}, {"id":3, "num":3}, {"id":5, "num":5}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 6, "num": 6}, map[interface{}]interface{}{"id": 1, "num": 1}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 5, "num": 5}}
		/* even.order_by("num").union(odd.order_by("num"), interleave = false) */

		suite.T().Log("About to run line #16: even.OrderBy('num').Union(odd.OrderBy('num')).OptArgs(r.UnionOpts{Interleave: false, })")

		runAndAssert(suite.Suite, expected_, even.OrderBy("num").Union(odd.OrderBy("num")).OptArgs(r.UnionOpts{Interleave: false}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #16")
	}

	{
		// transform/unordered_map.yaml line #22
		/* [{"id":1, "num":1}, {"id":2, "num":2}, {"id":3, "num":3}, {"id":4, "num":4}, {"id":5, "num":5}, {"id":6, "num":6}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 1, "num": 1}, map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 5, "num": 5}, map[interface{}]interface{}{"id": 6, "num": 6}}
		/* odd.order_by("num").union(even.order_by("num"), interleave="num") */

		suite.T().Log("About to run line #22: odd.OrderBy('num').Union(even.OrderBy('num')).OptArgs(r.UnionOpts{Interleave: 'num', })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num").Union(even.OrderBy("num")).OptArgs(r.UnionOpts{Interleave: "num"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #22")
	}

	{
		// transform/unordered_map.yaml line #28
		/* err("ReqlQueryLogicError","The streams given as arguments are not ordered by given ordering.") */
		var expected_ Err = err("ReqlQueryLogicError", "The streams given as arguments are not ordered by given ordering.")
		/* odd.order_by("num").union(even.order_by("num"), interleave=r.desc("num")) */

		suite.T().Log("About to run line #28: odd.OrderBy('num').Union(even.OrderBy('num')).OptArgs(r.UnionOpts{Interleave: r.Desc('num'), })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num").Union(even.OrderBy("num")).OptArgs(r.UnionOpts{Interleave: r.Desc("num")}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #28")
	}

	{
		// transform/unordered_map.yaml line #34
		/* [{"id":1, "num":1}, {"id":2, "num":2}, {"id":3, "num":3}, {"id":4, "num":4}, {"id":5, "num":5}, {"id":6, "num":6}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 1, "num": 1}, map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 5, "num": 5}, map[interface{}]interface{}{"id": 6, "num": 6}}
		/* odd.order_by("num").union(even.order_by("num"), interleave=lambda x: x["num"]) */

		suite.T().Log("About to run line #34: odd.OrderBy('num').Union(even.OrderBy('num')).OptArgs(r.UnionOpts{Interleave: func(x r.Term) interface{} { return x.AtIndex('num')}, })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num").Union(even.OrderBy("num")).OptArgs(r.UnionOpts{Interleave: func(x r.Term) interface{} { return x.AtIndex("num") }}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #34")
	}

	{
		// transform/unordered_map.yaml line #40
		/* [{"id": 7, "num": 1}, {"id": 2, "num": 2}, {"id": 9, "num": 2}, {"id": 8, "num": 3}, {"id": 4, "num": 4}, {"id": 6, "num": 6}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 7, "num": 1}, map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 9, "num": 2}, map[interface{}]interface{}{"id": 8, "num": 3}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 6, "num": 6}}
		/* odd2.order_by("num", r.desc("id")).union(even.order_by("num", r.desc("id")), interleave=[lambda x: x["num"], lambda x: x["id"]]) */

		suite.T().Log("About to run line #40: odd2.OrderBy('num', r.Desc('id')).Union(even.OrderBy('num', r.Desc('id'))).OptArgs(r.UnionOpts{Interleave: []interface{}{func(x r.Term) interface{} { return x.AtIndex('num')}, func(x r.Term) interface{} { return x.AtIndex('id')}}, })")

		runAndAssert(suite.Suite, expected_, odd2.OrderBy("num", r.Desc("id")).Union(even.OrderBy("num", r.Desc("id"))).OptArgs(r.UnionOpts{Interleave: []interface{}{func(x r.Term) interface{} { return x.AtIndex("num") }, func(x r.Term) interface{} { return x.AtIndex("id") }}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #40")
	}

	{
		// transform/unordered_map.yaml line #46
		/* err("ReqlServerCompileError", "DESC may only be used as an argument to ORDER_BY or UNION.") */
		var expected_ Err = err("ReqlCompileError", "DESC may only be used as an argument to ORDER_BY or UNION.")
		/* odd.order_by("num").union(even.order_by("num"), interleave=lambda x: r.desc(x["num"])) */

		suite.T().Log("About to run line #46: odd.OrderBy('num').Union(even.OrderBy('num')).OptArgs(r.UnionOpts{Interleave: func(x r.Term) interface{} { return r.Desc(x.AtIndex('num'))}, })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num").Union(even.OrderBy("num")).OptArgs(r.UnionOpts{Interleave: func(x r.Term) interface{} { return r.Desc(x.AtIndex("num")) }}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #46")
	}

	{
		// transform/unordered_map.yaml line #50
		/* [{"id":6, "num":6}, {"id":5, "num":5}, {"id":4, "num":4}, {"id":3, "num":3}, {"id":2, "num":2}, {"id":1, "num":1}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 6, "num": 6}, map[interface{}]interface{}{"id": 5, "num": 5}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 1, "num": 1}}
		/* odd.order_by(r.desc("num")).union(even.order_by(r.desc("num")), interleave= [r.desc(lambda x: x["num"])]) */

		suite.T().Log("About to run line #50: odd.OrderBy(r.Desc('num')).Union(even.OrderBy(r.Desc('num'))).OptArgs(r.UnionOpts{Interleave: []interface{}{r.Desc(func(x r.Term) interface{} { return x.AtIndex('num')})}, })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy(r.Desc("num")).Union(even.OrderBy(r.Desc("num"))).OptArgs(r.UnionOpts{Interleave: []interface{}{r.Desc(func(x r.Term) interface{} { return x.AtIndex("num") })}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #50")
	}

	{
		// transform/unordered_map.yaml line #54
		/* [{"id":1, "num":1}, {"id":7, "num":1}, {"id":2, "num":2}, {"id":9, "num":2}, {"id":3, "num":3}, {"id":8, "num":3}, {"id":4, "num":4}, {"id":5, "num":5}, {"id":6, "num":6}, ] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 1, "num": 1}, map[interface{}]interface{}{"id": 7, "num": 1}, map[interface{}]interface{}{"id": 2, "num": 2}, map[interface{}]interface{}{"id": 9, "num": 2}, map[interface{}]interface{}{"id": 3, "num": 3}, map[interface{}]interface{}{"id": 8, "num": 3}, map[interface{}]interface{}{"id": 4, "num": 4}, map[interface{}]interface{}{"id": 5, "num": 5}, map[interface{}]interface{}{"id": 6, "num": 6}}
		/* odd.order_by("num", "id").union(even.order_by("num", "id"), odd2.order_by("num", "id"), interleave= ["num", "id"]) */

		suite.T().Log("About to run line #54: odd.OrderBy('num', 'id').Union(even.OrderBy('num', 'id'), odd2.OrderBy('num', 'id')).OptArgs(r.UnionOpts{Interleave: []interface{}{'num', 'id'}, })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num", "id").Union(even.OrderBy("num", "id"), odd2.OrderBy("num", "id")).OptArgs(r.UnionOpts{Interleave: []interface{}{"num", "id"}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #54")
	}

	{
		// transform/unordered_map.yaml line #58
		/* err("ReqlQueryLogicError","The streams given as arguments are not ordered by given ordering.") */
		var expected_ Err = err("ReqlQueryLogicError", "The streams given as arguments are not ordered by given ordering.")
		/* odd.order_by("num", "id").union(even.order_by("num", "id"), odd2.order_by(r.desc("num"), "id"), interleave= ["num", "id"]) */

		suite.T().Log("About to run line #58: odd.OrderBy('num', 'id').Union(even.OrderBy('num', 'id'), odd2.OrderBy(r.Desc('num'), 'id')).OptArgs(r.UnionOpts{Interleave: []interface{}{'num', 'id'}, })")

		runAndAssert(suite.Suite, expected_, odd.OrderBy("num", "id").Union(even.OrderBy("num", "id"), odd2.OrderBy(r.Desc("num"), "id")).OptArgs(r.UnionOpts{Interleave: []interface{}{"num", "id"}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #58")
	}
}
func (suite *ChangefeedsIncludeStatesSuite) TestCases() {
	suite.T().Log("Running ChangefeedsIncludeStatesSuite: Test `include_states`")

	tbl := r.DB("test").Table("tbl")
	_ = tbl // Prevent any noused variable errors

	{
		// changefeeds/include_states.yaml line #4
		/* [{'state':'ready'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "ready"}}
		/* tbl.changes(squash=true, include_states=true).limit(1) */

		suite.T().Log("About to run line #4: tbl.Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, }).Limit(1)")

		runAndAssert(suite.Suite, expected_, tbl.Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true}).Limit(1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #4")
	}

	{
		// changefeeds/include_states.yaml line #9
		/* [{'state':'initializing'}, {'new_val':null}, {'state':'ready'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "initializing"}, map[interface{}]interface{}{"new_val": nil}, map[interface{}]interface{}{"state": "ready"}}
		/* tbl.get(0).changes(squash=true, include_states=true, include_initial=true).limit(3) */

		suite.T().Log("About to run line #9: tbl.Get(0).Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, IncludeInitial: true, }).Limit(3)")

		runAndAssert(suite.Suite, expected_, tbl.Get(0).Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, IncludeInitial: true}).Limit(3), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #9")
	}

	{
		// changefeeds/include_states.yaml line #14
		/* [{'state':'initializing'}, {'state':'ready'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "initializing"}, map[interface{}]interface{}{"state": "ready"}}
		/* tbl.order_by(index='id').limit(10).changes(squash=true, include_states=true, include_initial=true).limit(2) */

		suite.T().Log("About to run line #14: tbl.OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).Limit(10).Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, IncludeInitial: true, }).Limit(2)")

		runAndAssert(suite.Suite, expected_, tbl.OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).Limit(10).Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, IncludeInitial: true}).Limit(2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #14")
	}

	{
		// changefeeds/include_states.yaml line #19
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* tbl.insert({'id':1}) */

		suite.T().Log("About to run line #19: tbl.Insert(map[interface{}]interface{}{'id': 1, })")

		runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #19")
	}

	{
		// changefeeds/include_states.yaml line #21
		/* [{'state':'initializing'}, {'new_val':{'id':1}}, {'state':'ready'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "initializing"}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 1}}, map[interface{}]interface{}{"state": "ready"}}
		/* tbl.order_by(index='id').limit(10).changes(squash=true, include_states=true, include_initial=true).limit(3) */

		suite.T().Log("About to run line #21: tbl.OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).Limit(10).Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, IncludeInitial: true, }).Limit(3)")

		runAndAssert(suite.Suite, expected_, tbl.OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).Limit(10).Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, IncludeInitial: true}).Limit(3), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #21")
	}

	// changefeeds/include_states.yaml line #26
	// tblchanges = tbl.changes(squash=true, include_states=true)
	suite.T().Log("Possibly executing: var tblchanges r.Term = tbl.Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true, })")

	tblchanges := maybeRun(tbl.Changes().OptArgs(r.ChangesOpts{Squash: true, IncludeStates: true}), suite.session, r.RunOpts{})
	_ = tblchanges // Prevent any noused variable errors

	{
		// changefeeds/include_states.yaml line #30
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* tbl.insert({'id':2}) */

		suite.T().Log("About to run line #30: tbl.Insert(map[interface{}]interface{}{'id': 2, })")

		runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 2}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #30")
	}

	{
		// changefeeds/include_states.yaml line #32
		/* [{'state':'ready'},{'new_val':{'id':2},'old_val':null}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "ready"}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 2}, "old_val": nil}}
		/* fetch(tblchanges, 2) */

		suite.T().Log("About to run line #32: fetch(tblchanges, 2)")

		fetchAndAssert(suite.Suite, expected_, tblchanges, 2)
		suite.T().Log("Finished running line #32")
	}

	// changefeeds/include_states.yaml line #35
	// getchanges = tbl.get(2).changes(include_states=true, include_initial=true)
	suite.T().Log("Possibly executing: var getchanges r.Term = tbl.Get(2).Changes().OptArgs(r.ChangesOpts{IncludeStates: true, IncludeInitial: true, })")

	getchanges := maybeRun(tbl.Get(2).Changes().OptArgs(r.ChangesOpts{IncludeStates: true, IncludeInitial: true}), suite.session, r.RunOpts{})
	_ = getchanges // Prevent any noused variable errors

	{
		// changefeeds/include_states.yaml line #39
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* tbl.get(2).update({'a':1}) */

		suite.T().Log("About to run line #39: tbl.Get(2).Update(map[interface{}]interface{}{'a': 1, })")

		runAndAssert(suite.Suite, expected_, tbl.Get(2).Update(map[interface{}]interface{}{"a": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #39")
	}

	{
		// changefeeds/include_states.yaml line #41
		/* [{'state':'initializing'}, {'new_val':{'id':2}}, {'state':'ready'}, {'old_val':{'id':2},'new_val':{'id':2,'a':1}}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "initializing"}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 2}}, map[interface{}]interface{}{"state": "ready"}, map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 2}, "new_val": map[interface{}]interface{}{"id": 2, "a": 1}}}
		/* fetch(getchanges, 4) */

		suite.T().Log("About to run line #41: fetch(getchanges, 4)")

		fetchAndAssert(suite.Suite, expected_, getchanges, 4)
		suite.T().Log("Finished running line #41")
	}

	// changefeeds/include_states.yaml line #44
	// limitchanges = tbl.order_by(index='id').limit(10).changes(include_states=true, include_initial=true)
	suite.T().Log("Possibly executing: var limitchanges r.Term = tbl.OrderBy().OptArgs(r.OrderByOpts{Index: 'id', }).Limit(10).Changes().OptArgs(r.ChangesOpts{IncludeStates: true, IncludeInitial: true, })")

	limitchanges := maybeRun(tbl.OrderBy().OptArgs(r.OrderByOpts{Index: "id"}).Limit(10).Changes().OptArgs(r.ChangesOpts{IncludeStates: true, IncludeInitial: true}), suite.session, r.RunOpts{})
	_ = limitchanges // Prevent any noused variable errors

	// changefeeds/include_states.yaml line #48
	// limitchangesdesc = tbl.order_by(index=r.desc('id')).limit(10).changes(include_states=true, include_initial=true)
	suite.T().Log("Possibly executing: var limitchangesdesc r.Term = tbl.OrderBy().OptArgs(r.OrderByOpts{Index: r.Desc('id'), }).Limit(10).Changes().OptArgs(r.ChangesOpts{IncludeStates: true, IncludeInitial: true, })")

	limitchangesdesc := maybeRun(tbl.OrderBy().OptArgs(r.OrderByOpts{Index: r.Desc("id")}).Limit(10).Changes().OptArgs(r.ChangesOpts{IncludeStates: true, IncludeInitial: true}), suite.session, r.RunOpts{})
	_ = limitchangesdesc // Prevent any noused variable errors

	{
		// changefeeds/include_states.yaml line #52
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* tbl.insert({'id':3}) */

		suite.T().Log("About to run line #52: tbl.Insert(map[interface{}]interface{}{'id': 3, })")

		runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 3}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #52")
	}

	{
		// changefeeds/include_states.yaml line #54
		/* [{'state':'initializing'}, {'new_val':{'id':1}}, {'new_val':{'a':1, 'id':2}}, {'state':'ready'}, {'old_val':null, 'new_val':{'id':3}}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "initializing"}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 1}}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 1, "id": 2}}, map[interface{}]interface{}{"state": "ready"}, map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 3}}}
		/* fetch(limitchanges, 5) */

		suite.T().Log("About to run line #54: fetch(limitchanges, 5)")

		fetchAndAssert(suite.Suite, expected_, limitchanges, 5)
		suite.T().Log("Finished running line #54")
	}

	{
		// changefeeds/include_states.yaml line #57
		/* [{'state':'initializing'}, {'new_val':{'a':1, 'id':2}}, {'new_val':{'id':1}}, {'state':'ready'}, {'old_val':null, 'new_val':{'id':3}}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"state": "initializing"}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"a": 1, "id": 2}}, map[interface{}]interface{}{"new_val": map[interface{}]interface{}{"id": 1}}, map[interface{}]interface{}{"state": "ready"}, map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 3}}}
		/* fetch(limitchangesdesc, 5) */

		suite.T().Log("About to run line #57: fetch(limitchangesdesc, 5)")

		fetchAndAssert(suite.Suite, expected_, limitchangesdesc, 5)
		suite.T().Log("Finished running line #57")
	}
}
Exemplo n.º 20
0
func (suite *MutationSyncSuite) TestCases() {
	suite.T().Log("Running MutationSyncSuite: Tests syncing tables")

	{
		// mutation/sync.yaml line #5
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* r.db('test').table_create('test1') */

		suite.T().Log("About to run line #5: r.DB('test').TableCreate('test1')")

		runAndAssert(suite.Suite, expected_, r.DB("test").TableCreate("test1"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #5")
	}

	{
		// mutation/sync.yaml line #7
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* r.db('test').table_create('test1soft') */

		suite.T().Log("About to run line #7: r.DB('test').TableCreate('test1soft')")

		runAndAssert(suite.Suite, expected_, r.DB("test").TableCreate("test1soft"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #7")
	}

	{
		// mutation/sync.yaml line #9
		/* {'skipped':0, 'deleted':0, 'unchanged':0, 'errors':0, 'replaced':1, 'inserted':0} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"skipped": 0, "deleted": 0, "unchanged": 0, "errors": 0, "replaced": 1, "inserted": 0}
		/* r.db('test').table('test1soft').config().update({'durability':'soft'}) */

		suite.T().Log("About to run line #9: r.DB('test').Table('test1soft').Config().Update(map[interface{}]interface{}{'durability': 'soft', })")

		runAndAssert(suite.Suite, expected_, r.DB("test").Table("test1soft").Config().Update(map[interface{}]interface{}{"durability": "soft"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #9")
	}

	// mutation/sync.yaml line #11
	// tbl = r.db('test').table('test1')
	suite.T().Log("Possibly executing: var tbl r.Term = r.DB('test').Table('test1')")

	tbl := r.DB("test").Table("test1")
	_ = tbl // Prevent any noused variable errors

	// mutation/sync.yaml line #12
	// tbl_soft = r.db('test').table('test1soft')
	suite.T().Log("Possibly executing: var tbl_soft r.Term = r.DB('test').Table('test1soft')")

	tbl_soft := r.DB("test").Table("test1soft")
	_ = tbl_soft // Prevent any noused variable errors

	{
		// mutation/sync.yaml line #13
		/* partial({'created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"created": 1})
		/* tbl.index_create('x') */

		suite.T().Log("About to run line #13: tbl.IndexCreate('x')")

		runAndAssert(suite.Suite, expected_, tbl.IndexCreate("x"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #13")
	}

	{
		// mutation/sync.yaml line #15
		/* [{'ready':True, 'index':'x'}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"ready": true, "index": "x"}}
		/* tbl.index_wait('x').pluck('index', 'ready') */

		suite.T().Log("About to run line #15: tbl.IndexWait('x').Pluck('index', 'ready')")

		runAndAssert(suite.Suite, expected_, tbl.IndexWait("x").Pluck("index", "ready"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #15")
	}

	{
		// mutation/sync.yaml line #19
		/* {'synced':1} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"synced": 1}
		/* tbl.sync() */

		suite.T().Log("About to run line #19: tbl.Sync()")

		runAndAssert(suite.Suite, expected_, tbl.Sync(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #19")
	}

	{
		// mutation/sync.yaml line #21
		/* {'synced':1} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"synced": 1}
		/* tbl_soft.sync() */

		suite.T().Log("About to run line #21: tbl_soft.Sync()")

		runAndAssert(suite.Suite, expected_, tbl_soft.Sync(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #21")
	}

	{
		// mutation/sync.yaml line #23
		/* {'synced':1} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"synced": 1}
		/* tbl.sync() */

		suite.T().Log("About to run line #23: tbl.Sync()")

		runAndAssert(suite.Suite, expected_, tbl.Sync(), suite.session, r.RunOpts{
			Durability:     "soft",
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #23")
	}

	{
		// mutation/sync.yaml line #27
		/* {'synced':1} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"synced": 1}
		/* tbl.sync() */

		suite.T().Log("About to run line #27: tbl.Sync()")

		runAndAssert(suite.Suite, expected_, tbl.Sync(), suite.session, r.RunOpts{
			Durability:     "hard",
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #27")
	}

	{
		// mutation/sync.yaml line #48
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* r.db('test').table_drop('test1') */

		suite.T().Log("About to run line #48: r.DB('test').TableDrop('test1')")

		runAndAssert(suite.Suite, expected_, r.DB("test").TableDrop("test1"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #48")
	}

	{
		// mutation/sync.yaml line #50
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* r.db('test').table_drop('test1soft') */

		suite.T().Log("About to run line #50: r.DB('test').TableDrop('test1soft')")

		runAndAssert(suite.Suite, expected_, r.DB("test").TableDrop("test1soft"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #50")
	}
}
Exemplo n.º 21
0
func (suite *JoinsSuite) TestCases() {
	suite.T().Log("Running JoinsSuite: Tests that manipulation data in tables")

	messages := r.DB("test").Table("messages")
	_ = messages // Prevent any noused variable errors
	otbl := r.DB("test").Table("otbl")
	_ = otbl // Prevent any noused variable errors
	otbl2 := r.DB("test").Table("otbl2")
	_ = otbl2 // Prevent any noused variable errors
	receivers := r.DB("test").Table("receivers")
	_ = receivers // Prevent any noused variable errors
	senders := r.DB("test").Table("senders")
	_ = senders // Prevent any noused variable errors
	tbl := r.DB("test").Table("tbl")
	_ = tbl // Prevent any noused variable errors
	tbl2 := r.DB("test").Table("tbl2")
	_ = tbl2 // Prevent any noused variable errors

	{
		// joins.yaml line #7
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* r.db('test').table_create('test3', primary_key='foo') */

		suite.T().Log("About to run line #7: r.DB('test').TableCreate('test3').OptArgs(r.TableCreateOpts{PrimaryKey: 'foo', })")

		runAndAssert(suite.Suite, expected_, r.DB("test").TableCreate("test3").OptArgs(r.TableCreateOpts{PrimaryKey: "foo"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #7")
	}

	// joins.yaml line #11
	// tbl3 = r.db('test').table('test3')
	suite.T().Log("Possibly executing: var tbl3 r.Term = r.DB('test').Table('test3')")

	tbl3 := r.DB("test").Table("test3")
	_ = tbl3 // Prevent any noused variable errors

	{
		// joins.yaml line #13
		/* partial({'errors':0, 'inserted':100}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 100})
		/* tbl.insert(r.range(0, 100).map({'id':r.row, 'a':r.row % 4})) */

		suite.T().Log("About to run line #13: tbl.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{'id': r.Row, 'a': r.Row.Mod(4), }))")

		runAndAssert(suite.Suite, expected_, tbl.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{"id": r.Row, "a": r.Row.Mod(4)})), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #13")
	}

	{
		// joins.yaml line #18
		/* partial({'errors':0, 'inserted':100}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 100})
		/* tbl2.insert(r.range(0, 100).map({'id':r.row, 'b':r.row % 4})) */

		suite.T().Log("About to run line #18: tbl2.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{'id': r.Row, 'b': r.Row.Mod(4), }))")

		runAndAssert(suite.Suite, expected_, tbl2.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{"id": r.Row, "b": r.Row.Mod(4)})), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #18")
	}

	{
		// joins.yaml line #23
		/* partial({'errors':0, 'inserted':100}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 100})
		/* tbl3.insert(r.range(0, 100).map({'foo':r.row, 'b':r.row % 4})) */

		suite.T().Log("About to run line #23: tbl3.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{'foo': r.Row, 'b': r.Row.Mod(4), }))")

		runAndAssert(suite.Suite, expected_, tbl3.Insert(r.Range(0, 100).Map(map[interface{}]interface{}{"foo": r.Row, "b": r.Row.Mod(4)})), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #23")
	}

	{
		// joins.yaml line #28
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* otbl.insert(r.range(1,100).map({'id': r.row, 'a': r.row})) */

		suite.T().Log("About to run line #28: otbl.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{'id': r.Row, 'a': r.Row, }))")

		runAndAssert(suite.Suite, expected_, otbl.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{"id": r.Row, "a": r.Row})), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #28")
	}

	{
		// joins.yaml line #29
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* otbl2.insert(r.range(1,100).map({'id': r.row, 'b': 2 * r.row})) */

		suite.T().Log("About to run line #29: otbl2.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{'id': r.Row, 'b': r.Mul(2, r.Row), }))")

		runAndAssert(suite.Suite, expected_, otbl2.Insert(r.Range(1, 100).Map(map[interface{}]interface{}{"id": r.Row, "b": r.Mul(2, r.Row)})), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #29")
	}

	// joins.yaml line #34
	// ij = tbl.inner_join(tbl2, lambda x,y:x['a'] == y['b']).zip()
	suite.T().Log("Possibly executing: var ij r.Term = tbl.InnerJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex('a').Eq(y.AtIndex('b'))}).Zip()")

	ij := tbl.InnerJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex("a").Eq(y.AtIndex("b")) }).Zip()
	_ = ij // Prevent any noused variable errors

	{
		// joins.yaml line #37
		/* 2500 */
		var expected_ int = 2500
		/* ij.count() */

		suite.T().Log("About to run line #37: ij.Count()")

		runAndAssert(suite.Suite, expected_, ij.Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #37")
	}

	{
		// joins.yaml line #39
		/* 0 */
		var expected_ int = 0
		/* ij.filter(lambda row:row['a'] != row['b']).count() */

		suite.T().Log("About to run line #39: ij.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Ne(row.AtIndex('b'))}).Count()")

		runAndAssert(suite.Suite, expected_, ij.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Ne(row.AtIndex("b")) }).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #39")
	}

	// joins.yaml line #46
	// oj = tbl.outer_join(tbl2, lambda x,y:x['a'] == y['b']).zip()
	suite.T().Log("Possibly executing: var oj r.Term = tbl.OuterJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex('a').Eq(y.AtIndex('b'))}).Zip()")

	oj := tbl.OuterJoin(tbl2, func(x r.Term, y r.Term) interface{} { return x.AtIndex("a").Eq(y.AtIndex("b")) }).Zip()
	_ = oj // Prevent any noused variable errors

	{
		// joins.yaml line #49
		/* 2500 */
		var expected_ int = 2500
		/* oj.count() */

		suite.T().Log("About to run line #49: oj.Count()")

		runAndAssert(suite.Suite, expected_, oj.Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #49")
	}

	{
		// joins.yaml line #51
		/* 0 */
		var expected_ int = 0
		/* oj.filter(lambda row:row['a'] != row['b']).count() */

		suite.T().Log("About to run line #51: oj.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Ne(row.AtIndex('b'))}).Count()")

		runAndAssert(suite.Suite, expected_, oj.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Ne(row.AtIndex("b")) }).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #51")
	}

	// joins.yaml line #57
	// blah = otbl.order_by("id").eq_join(r.row['id'], otbl2, ordered=True).zip()
	suite.T().Log("Possibly executing: var blah r.Term = otbl.OrderBy('id').EqJoin(r.Row.AtIndex('id'), otbl2).OptArgs(r.EqJoinOpts{Ordered: true, }).Zip()")

	blah := maybeRun(otbl.OrderBy("id").EqJoin(r.Row.AtIndex("id"), otbl2).OptArgs(r.EqJoinOpts{Ordered: true}).Zip(), suite.session, r.RunOpts{})
	_ = blah // Prevent any noused variable errors

	// joins.yaml line #59
	// blah = otbl.order_by(r.desc("id")).eq_join(r.row['id'], otbl2, ordered=True).zip()
	suite.T().Log("Possibly executing: var blah r.Term = otbl.OrderBy(r.Desc('id')).EqJoin(r.Row.AtIndex('id'), otbl2).OptArgs(r.EqJoinOpts{Ordered: true, }).Zip()")

	blah = maybeRun(otbl.OrderBy(r.Desc("id")).EqJoin(r.Row.AtIndex("id"), otbl2).OptArgs(r.EqJoinOpts{Ordered: true}).Zip(), suite.session, r.RunOpts{})

	// joins.yaml line #61
	// blah = otbl.order_by("id").eq_join(r.row['a'], otbl2, ordered=True).zip()
	suite.T().Log("Possibly executing: var blah r.Term = otbl.OrderBy('id').EqJoin(r.Row.AtIndex('a'), otbl2).OptArgs(r.EqJoinOpts{Ordered: true, }).Zip()")

	blah = maybeRun(otbl.OrderBy("id").EqJoin(r.Row.AtIndex("a"), otbl2).OptArgs(r.EqJoinOpts{Ordered: true}).Zip(), suite.session, r.RunOpts{})

	{
		// joins.yaml line #65
		/* 100 */
		var expected_ int = 100
		/* tbl.eq_join('a', tbl2).zip().count() */

		suite.T().Log("About to run line #65: tbl.EqJoin('a', tbl2).Zip().Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin("a", tbl2).Zip().Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #65")
	}

	{
		// joins.yaml line #68
		/* 0 */
		var expected_ int = 0
		/* tbl.eq_join('fake', tbl2).zip().count() */

		suite.T().Log("About to run line #68: tbl.EqJoin('fake', tbl2).Zip().Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin("fake", tbl2).Zip().Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #68")
	}

	{
		// joins.yaml line #71
		/* 100 */
		var expected_ int = 100
		/* tbl.eq_join(lambda x:x['a'], tbl2).zip().count() */

		suite.T().Log("About to run line #71: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('a')}, tbl2).Zip().Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("a") }, tbl2).Zip().Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #71")
	}

	{
		// joins.yaml line #76
		/* 0 */
		var expected_ int = 0
		/* tbl.eq_join(lambda x:x['fake'], tbl2).zip().count() */

		suite.T().Log("About to run line #76: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('fake')}, tbl2).Zip().Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("fake") }, tbl2).Zip().Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #76")
	}

	{
		// joins.yaml line #81
		/* 0 */
		var expected_ int = 0
		/* tbl.eq_join(lambda x:null, tbl2).zip().count() */

		suite.T().Log("About to run line #81: tbl.EqJoin(func(x r.Term) interface{} { return nil}, tbl2).Zip().Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return nil }, tbl2).Zip().Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #81")
	}

	{
		// joins.yaml line #86
		/* 100 */
		var expected_ int = 100
		/* tbl.eq_join(lambda x:x['a'], tbl2).count() */

		suite.T().Log("About to run line #86: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('a')}, tbl2).Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("a") }, tbl2).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #86")
	}

	{
		// joins.yaml line #92
		/* 100 */
		var expected_ int = 100
		/* tbl.eq_join('a', tbl3).zip().count() */

		suite.T().Log("About to run line #92: tbl.EqJoin('a', tbl3).Zip().Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin("a", tbl3).Zip().Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #92")
	}

	{
		// joins.yaml line #95
		/* 100 */
		var expected_ int = 100
		/* tbl.eq_join(lambda x:x['a'], tbl3).count() */

		suite.T().Log("About to run line #95: tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex('a')}, tbl3).Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin(func(x r.Term) interface{} { return x.AtIndex("a") }, tbl3).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #95")
	}

	{
		// joins.yaml line #101
		/* 100 */
		var expected_ int = 100
		/* tbl.eq_join(r.row['a'], tbl2).count() */

		suite.T().Log("About to run line #101: tbl.EqJoin(r.Row.AtIndex('a'), tbl2).Count()")

		runAndAssert(suite.Suite, expected_, tbl.EqJoin(r.Row.AtIndex("a"), tbl2).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #101")
	}

	// joins.yaml line #106
	// left = r.expr([{'a':1},{'a':2},{'a':3}])
	suite.T().Log("Possibly executing: var left r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'a': 1, }, map[interface{}]interface{}{'a': 2, }, map[interface{}]interface{}{'a': 3, }})")

	left := r.Expr([]interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2}, map[interface{}]interface{}{"a": 3}})
	_ = left // Prevent any noused variable errors

	// joins.yaml line #107
	// right = r.expr([{'b':2},{'b':3}])
	suite.T().Log("Possibly executing: var right r.Term = r.Expr([]interface{}{map[interface{}]interface{}{'b': 2, }, map[interface{}]interface{}{'b': 3, }})")

	right := r.Expr([]interface{}{map[interface{}]interface{}{"b": 2}, map[interface{}]interface{}{"b": 3}})
	_ = right // Prevent any noused variable errors

	{
		// joins.yaml line #109
		/* [{'a':2,'b':2},{'a':3,'b':3}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 2, "b": 2}, map[interface{}]interface{}{"a": 3, "b": 3}}
		/* left.inner_join(right, lambda l, r:l['a'] == r['b']).zip() */

		suite.T().Log("About to run line #109: left.InnerJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex('a').Eq(r.AtIndex('b'))}).Zip()")

		runAndAssert(suite.Suite, expected_, left.InnerJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex("a").Eq(r.AtIndex("b")) }).Zip(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #109")
	}

	{
		// joins.yaml line #115
		/* [{'a':1},{'a':2,'b':2},{'a':3,'b':3}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 1}, map[interface{}]interface{}{"a": 2, "b": 2}, map[interface{}]interface{}{"a": 3, "b": 3}}
		/* left.outer_join(right, lambda l, r:l['a'] == r['b']).zip() */

		suite.T().Log("About to run line #115: left.OuterJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex('a').Eq(r.AtIndex('b'))}).Zip()")

		runAndAssert(suite.Suite, expected_, left.OuterJoin(right, func(l r.Term, r r.Term) interface{} { return l.AtIndex("a").Eq(r.AtIndex("b")) }).Zip(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #115")
	}

	{
		// joins.yaml line #132
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* r.db('test').table_drop('test3') */

		suite.T().Log("About to run line #132: r.DB('test').TableDrop('test3')")

		runAndAssert(suite.Suite, expected_, r.DB("test").TableDrop("test3"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #132")
	}
}
Exemplo n.º 22
0
func (suite *TimesIndexSuite) TestCases() {
	suite.T().Log("Running TimesIndexSuite: secondary indexes on times")

	tbl := r.DB("test").Table("tbl")
	_ = tbl // Prevent any noused variable errors

	// times/index.yaml line #7
	// ts={"timezone":"-07:00","epoch_time":1375445162.0872,"$reql_type$":"TIME"}
	suite.T().Log("Possibly executing: var ts map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445162.0872, '$reql_type$': 'TIME', }")

	ts := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445162.0872, "$reql_type$": "TIME"}
	_ = ts // Prevent any noused variable errors

	// times/index.yaml line #11
	// t1={"timezone":"-07:00","epoch_time":1375445163.0872,"$reql_type$":"TIME"}
	suite.T().Log("Possibly executing: var t1 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.0872, '$reql_type$': 'TIME', }")

	t1 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.0872, "$reql_type$": "TIME"}
	_ = t1 // Prevent any noused variable errors

	// times/index.yaml line #15
	// t2={"timezone":"-07:00","epoch_time":1375445163.08832,"$reql_type$":"TIME"}
	suite.T().Log("Possibly executing: var t2 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.08832, '$reql_type$': 'TIME', }")

	t2 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.08832, "$reql_type$": "TIME"}
	_ = t2 // Prevent any noused variable errors

	// times/index.yaml line #19
	// t3={"timezone":"-07:00","epoch_time":1375445163.08943,"$reql_type$":"TIME"}
	suite.T().Log("Possibly executing: var t3 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.08943, '$reql_type$': 'TIME', }")

	t3 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.08943, "$reql_type$": "TIME"}
	_ = t3 // Prevent any noused variable errors

	// times/index.yaml line #23
	// t4={"timezone":"-07:00","epoch_time":1375445163.09055,"$reql_type$":"TIME"}
	suite.T().Log("Possibly executing: var t4 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.09055, '$reql_type$': 'TIME', }")

	t4 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.09055, "$reql_type$": "TIME"}
	_ = t4 // Prevent any noused variable errors

	// times/index.yaml line #27
	// t5={"timezone":"-07:00","epoch_time":1375445163.09166,"$reql_type$":"TIME"}
	suite.T().Log("Possibly executing: var t5 map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445163.09166, '$reql_type$': 'TIME', }")

	t5 := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445163.09166, "$reql_type$": "TIME"}
	_ = t5 // Prevent any noused variable errors

	// times/index.yaml line #31
	// te={"timezone":"-07:00","epoch_time":1375445164.0872,"$reql_type$":"TIME"}
	suite.T().Log("Possibly executing: var te map[interface{}]interface{} = map[interface{}]interface{}{'timezone': '-07:00', 'epoch_time': 1375445164.0872, '$reql_type$': 'TIME', }")

	te := map[interface{}]interface{}{"timezone": "-07:00", "epoch_time": 1375445164.0872, "$reql_type$": "TIME"}
	_ = te // Prevent any noused variable errors

	// times/index.yaml line #36
	// trows = [{'id':t1}, {'id':t2}, {'id':t3}, {'id':t4}, {'id':t5}]
	suite.T().Log("Possibly executing: var trows []interface{} = []interface{}{map[interface{}]interface{}{'id': t1, }, map[interface{}]interface{}{'id': t2, }, map[interface{}]interface{}{'id': t3, }, map[interface{}]interface{}{'id': t4, }, map[interface{}]interface{}{'id': t5, }}")

	trows := []interface{}{map[interface{}]interface{}{"id": t1}, map[interface{}]interface{}{"id": t2}, map[interface{}]interface{}{"id": t3}, map[interface{}]interface{}{"id": t4}, map[interface{}]interface{}{"id": t5}}
	_ = trows // Prevent any noused variable errors

	{
		// times/index.yaml line #37
		/* 5 */
		var expected_ int = 5
		/* tbl.insert(trows)['inserted'] */

		suite.T().Log("About to run line #37: tbl.Insert(trows).AtIndex('inserted')")

		runAndAssert(suite.Suite, expected_, tbl.Insert(trows).AtIndex("inserted"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #37")
	}

	// times/index.yaml line #41
	// bad_insert = [{'id':r.expr(t1).in_timezone("Z")}]
	suite.T().Log("Possibly executing: var bad_insert []interface{} = []interface{}{map[interface{}]interface{}{'id': r.Expr(t1).InTimezone('Z'), }}")

	bad_insert := []interface{}{map[interface{}]interface{}{"id": r.Expr(t1).InTimezone("Z")}}
	_ = bad_insert // Prevent any noused variable errors

	{
		// times/index.yaml line #42
		/* ("Duplicate primary key `id`:\n{\n\t\"id\":\t{\n\t\t\"$reql_type$\":\t\"TIME\",\n\t\t\"epoch_time\":\t1375445163.087,\n\t\t\"timezone\":\t\"-07:00\"\n\t}\n}\n{\n\t\"id\":\t{\n\t\t\"$reql_type$\":\t\"TIME\",\n\t\t\"epoch_time\":\t1375445163.087,\n\t\t\"timezone\":\t\"+00:00\"\n\t}\n}") */
		var expected_ string = "Duplicate primary key `id`:\n{\n\t\"id\":\t{\n\t\t\"$reql_type$\":\t\"TIME\",\n\t\t\"epoch_time\":\t1375445163.087,\n\t\t\"timezone\":\t\"-07:00\"\n\t}\n}\n{\n\t\"id\":\t{\n\t\t\"$reql_type$\":\t\"TIME\",\n\t\t\"epoch_time\":\t1375445163.087,\n\t\t\"timezone\":\t\"+00:00\"\n\t}\n}"
		/* tbl.insert(bad_insert)['first_error'] */

		suite.T().Log("About to run line #42: tbl.Insert(bad_insert).AtIndex('first_error')")

		runAndAssert(suite.Suite, expected_, tbl.Insert(bad_insert).AtIndex("first_error"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #42")
	}

	{
		// times/index.yaml line #46
		/* 5 */
		var expected_ int = 5
		/* tbl.between(ts, te).count() */

		suite.T().Log("About to run line #46: tbl.Between(ts, te).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(ts, te).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #46")
	}

	{
		// times/index.yaml line #48
		/* 3 */
		var expected_ int = 3
		/* tbl.between(t1, t4).count() */

		suite.T().Log("About to run line #48: tbl.Between(t1, t4).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(t1, t4).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #48")
	}

	{
		// times/index.yaml line #51
		/* 4 */
		var expected_ int = 4
		/* tbl.between(t1, t4, right_bound='closed').count() */

		suite.T().Log("About to run line #51: tbl.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #51")
	}

	{
		// times/index.yaml line #54
		/* 5 */
		var expected_ int = 5
		/* tbl.between(r.expr(ts).in_timezone("+06:00"), te).count() */

		suite.T().Log("About to run line #54: tbl.Between(r.Expr(ts).InTimezone('+06:00'), te).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(r.Expr(ts).InTimezone("+06:00"), te).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #54")
	}

	{
		// times/index.yaml line #56
		/* 3 */
		var expected_ int = 3
		/* tbl.between(t1, r.expr(t4).in_timezone("+08:00")).count() */

		suite.T().Log("About to run line #56: tbl.Between(t1, r.Expr(t4).InTimezone('+08:00')).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(t1, r.Expr(t4).InTimezone("+08:00")).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #56")
	}

	{
		// times/index.yaml line #59
		/* 4 */
		var expected_ int = 4
		/* tbl.between(r.expr(t1).in_timezone("Z"), t4, right_bound='closed').count() */

		suite.T().Log("About to run line #59: tbl.Between(r.Expr(t1).InTimezone('Z'), t4).OptArgs(r.BetweenOpts{RightBound: 'closed', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(r.Expr(t1).InTimezone("Z"), t4).OptArgs(r.BetweenOpts{RightBound: "closed"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #59")
	}

	{
		// times/index.yaml line #64
		/* 5 */
		var expected_ int = 5
		/* tbl.update(lambda row:{'a':row['id']})['replaced'] */

		suite.T().Log("About to run line #64: tbl.Update(func(row r.Term) interface{} { return map[interface{}]interface{}{'a': row.AtIndex('id'), }}).AtIndex('replaced')")

		runAndAssert(suite.Suite, expected_, tbl.Update(func(row r.Term) interface{} { return map[interface{}]interface{}{"a": row.AtIndex("id")} }).AtIndex("replaced"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #64")
	}

	{
		// times/index.yaml line #67
		/* ({'created':1}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1}
		/* tbl.index_create('a') */

		suite.T().Log("About to run line #67: tbl.IndexCreate('a')")

		runAndAssert(suite.Suite, expected_, tbl.IndexCreate("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #67")
	}

	{
		// times/index.yaml line #69
		/* 1 */
		var expected_ int = 1
		/* tbl.index_wait('a').count() */

		suite.T().Log("About to run line #69: tbl.IndexWait('a').Count()")

		runAndAssert(suite.Suite, expected_, tbl.IndexWait("a").Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #69")
	}

	{
		// times/index.yaml line #73
		/* 5 */
		var expected_ int = 5
		/* tbl.between(ts, te, index='a').count() */

		suite.T().Log("About to run line #73: tbl.Between(ts, te).OptArgs(r.BetweenOpts{Index: 'a', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(ts, te).OptArgs(r.BetweenOpts{Index: "a"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #73")
	}

	{
		// times/index.yaml line #77
		/* 3 */
		var expected_ int = 3
		/* tbl.between(t1, t4, index='a').count() */

		suite.T().Log("About to run line #77: tbl.Between(t1, t4).OptArgs(r.BetweenOpts{Index: 'a', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(t1, t4).OptArgs(r.BetweenOpts{Index: "a"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #77")
	}

	{
		// times/index.yaml line #81
		/* 4 */
		var expected_ int = 4
		/* tbl.between(t1, t4, right_bound='closed', index='a').count() */

		suite.T().Log("About to run line #81: tbl.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: 'closed', Index: 'a', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: "closed", Index: "a"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #81")
	}

	{
		// times/index.yaml line #85
		/* 5 */
		var expected_ int = 5
		/* tbl.between(r.expr(ts).in_timezone("+06:00"), te, index='a').count() */

		suite.T().Log("About to run line #85: tbl.Between(r.Expr(ts).InTimezone('+06:00'), te).OptArgs(r.BetweenOpts{Index: 'a', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(r.Expr(ts).InTimezone("+06:00"), te).OptArgs(r.BetweenOpts{Index: "a"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #85")
	}

	{
		// times/index.yaml line #89
		/* 3 */
		var expected_ int = 3
		/* tbl.between(t1, r.expr(t4).in_timezone("+08:00"), index='a').count() */

		suite.T().Log("About to run line #89: tbl.Between(t1, r.Expr(t4).InTimezone('+08:00')).OptArgs(r.BetweenOpts{Index: 'a', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(t1, r.Expr(t4).InTimezone("+08:00")).OptArgs(r.BetweenOpts{Index: "a"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #89")
	}

	{
		// times/index.yaml line #93
		/* 4 */
		var expected_ int = 4
		/* tbl.between(r.expr(t1).in_timezone("Z"), t4, right_bound='closed', index='a').count() */

		suite.T().Log("About to run line #93: tbl.Between(r.Expr(t1).InTimezone('Z'), t4).OptArgs(r.BetweenOpts{RightBound: 'closed', Index: 'a', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(r.Expr(t1).InTimezone("Z"), t4).OptArgs(r.BetweenOpts{RightBound: "closed", Index: "a"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #93")
	}

	{
		// times/index.yaml line #98
		/* ({'created':1}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"created": 1}
		/* tbl.index_create('b', lambda row:r.branch(row['id'] < t4, row['a'], null)) */

		suite.T().Log("About to run line #98: tbl.IndexCreateFunc('b', func(row r.Term) interface{} { return r.Branch(row.AtIndex('id').Lt(t4), row.AtIndex('a'), nil)})")

		runAndAssert(suite.Suite, expected_, tbl.IndexCreateFunc("b", func(row r.Term) interface{} { return r.Branch(row.AtIndex("id").Lt(t4), row.AtIndex("a"), nil) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #98")
	}

	{
		// times/index.yaml line #101
		/* 1 */
		var expected_ int = 1
		/* tbl.index_wait('b').count() */

		suite.T().Log("About to run line #101: tbl.IndexWait('b').Count()")

		runAndAssert(suite.Suite, expected_, tbl.IndexWait("b").Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #101")
	}

	{
		// times/index.yaml line #105
		/* 1 */
		var expected_ int = 1
		/* tbl.index_wait('b').count() */

		suite.T().Log("About to run line #105: tbl.IndexWait('b').Count()")

		runAndAssert(suite.Suite, expected_, tbl.IndexWait("b").Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #105")
	}

	{
		// times/index.yaml line #109
		/* 3 */
		var expected_ int = 3
		/* tbl.between(ts, te, index='b').count() */

		suite.T().Log("About to run line #109: tbl.Between(ts, te).OptArgs(r.BetweenOpts{Index: 'b', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(ts, te).OptArgs(r.BetweenOpts{Index: "b"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #109")
	}

	{
		// times/index.yaml line #113
		/* 3 */
		var expected_ int = 3
		/* tbl.between(t1, t4, index='b').count() */

		suite.T().Log("About to run line #113: tbl.Between(t1, t4).OptArgs(r.BetweenOpts{Index: 'b', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(t1, t4).OptArgs(r.BetweenOpts{Index: "b"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #113")
	}

	{
		// times/index.yaml line #117
		/* 3 */
		var expected_ int = 3
		/* tbl.between(t1, t4, right_bound='closed', index='b').count() */

		suite.T().Log("About to run line #117: tbl.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: 'closed', Index: 'b', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(t1, t4).OptArgs(r.BetweenOpts{RightBound: "closed", Index: "b"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #117")
	}

	{
		// times/index.yaml line #121
		/* 3 */
		var expected_ int = 3
		/* tbl.between(r.expr(ts).in_timezone("+06:00"), te, index='b').count() */

		suite.T().Log("About to run line #121: tbl.Between(r.Expr(ts).InTimezone('+06:00'), te).OptArgs(r.BetweenOpts{Index: 'b', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(r.Expr(ts).InTimezone("+06:00"), te).OptArgs(r.BetweenOpts{Index: "b"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #121")
	}

	{
		// times/index.yaml line #125
		/* 3 */
		var expected_ int = 3
		/* tbl.between(t1, r.expr(t4).in_timezone("+08:00"), index='b').count() */

		suite.T().Log("About to run line #125: tbl.Between(t1, r.Expr(t4).InTimezone('+08:00')).OptArgs(r.BetweenOpts{Index: 'b', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(t1, r.Expr(t4).InTimezone("+08:00")).OptArgs(r.BetweenOpts{Index: "b"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #125")
	}

	{
		// times/index.yaml line #129
		/* 3 */
		var expected_ int = 3
		/* tbl.between(r.expr(t1).in_timezone("Z"), t4, right_bound='closed', index='b').count() */

		suite.T().Log("About to run line #129: tbl.Between(r.Expr(t1).InTimezone('Z'), t4).OptArgs(r.BetweenOpts{RightBound: 'closed', Index: 'b', }).Count()")

		runAndAssert(suite.Suite, expected_, tbl.Between(r.Expr(t1).InTimezone("Z"), t4).OptArgs(r.BetweenOpts{RightBound: "closed", Index: "b"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #129")
	}

	// times/index.yaml line #135
	// oldtime = datetime.fromtimestamp(1375147296.681, PacificTimeZone())
	suite.T().Log("Possibly executing: var oldtime time.Time = Ast.Fromtimestamp(1375147296.681, PacificTimeZone())")

	oldtime := Ast.Fromtimestamp(1375147296.681, PacificTimeZone())
	_ = oldtime // Prevent any noused variable errors

	// times/index.yaml line #139
	// curtime = datetime.now()
	suite.T().Log("Possibly executing: var curtime time.Time = Ast.Now()")

	curtime := Ast.Now()
	_ = curtime // Prevent any noused variable errors

	{
		// times/index.yaml line #142
		/* 1 */
		var expected_ int = 1
		/* tbl.insert([{'id':oldtime}])['inserted'] */

		suite.T().Log("About to run line #142: tbl.Insert([]interface{}{map[interface{}]interface{}{'id': oldtime, }}).AtIndex('inserted')")

		runAndAssert(suite.Suite, expected_, tbl.Insert([]interface{}{map[interface{}]interface{}{"id": oldtime}}).AtIndex("inserted"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #142")
	}

	{
		// times/index.yaml line #148
		/* ("PTYPE<TIME>") */
		var expected_ string = "PTYPE<TIME>"
		/* tbl.get(oldtime)['id'].type_of() */

		suite.T().Log("About to run line #148: tbl.Get(oldtime).AtIndex('id').TypeOf()")

		runAndAssert(suite.Suite, expected_, tbl.Get(oldtime).AtIndex("id").TypeOf(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #148")
	}
}
Exemplo n.º 23
0
func (suite *ChangefeedsPointSuite) TestCases() {
	suite.T().Log("Running ChangefeedsPointSuite: Test point changebasics")

	tbl := r.DB("test").Table("tbl")
	_ = tbl // Prevent any noused variable errors

	// changefeeds/point.yaml line #10
	// basic = tbl.get(1).changes(include_initial=True)
	suite.T().Log("Possibly executing: var basic r.Term = tbl.Get(1).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true, })")

	basic := maybeRun(tbl.Get(1).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true}), suite.session, r.RunOpts{})
	_ = basic // Prevent any noused variable errors

	{
		// changefeeds/point.yaml line #14
		/* [{'new_val':null}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"new_val": nil}}
		/* fetch(basic, 1) */

		suite.T().Log("About to run line #14: fetch(basic, 1)")

		fetchAndAssert(suite.Suite, expected_, basic, 1)
		suite.T().Log("Finished running line #14")
	}

	{
		// changefeeds/point.yaml line #19
		/* partial({'errors':0, 'inserted':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 1})
		/* tbl.insert({'id':1}) */

		suite.T().Log("About to run line #19: tbl.Insert(map[interface{}]interface{}{'id': 1, })")

		runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #19")
	}

	{
		// changefeeds/point.yaml line #22
		/* [{'old_val':null, 'new_val':{'id':1}}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 1}}}
		/* fetch(basic, 1) */

		suite.T().Log("About to run line #22: fetch(basic, 1)")

		fetchAndAssert(suite.Suite, expected_, basic, 1)
		suite.T().Log("Finished running line #22")
	}

	{
		// changefeeds/point.yaml line #27
		/* partial({'errors':0, 'replaced':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1})
		/* tbl.get(1).update({'update':1}) */

		suite.T().Log("About to run line #27: tbl.Get(1).Update(map[interface{}]interface{}{'update': 1, })")

		runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"update": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #27")
	}

	{
		// changefeeds/point.yaml line #30
		/* [{'old_val':{'id':1}, 'new_val':{'id':1,'update':1}}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1}, "new_val": map[interface{}]interface{}{"id": 1, "update": 1}}}
		/* fetch(basic, 1) */

		suite.T().Log("About to run line #30: fetch(basic, 1)")

		fetchAndAssert(suite.Suite, expected_, basic, 1)
		suite.T().Log("Finished running line #30")
	}

	{
		// changefeeds/point.yaml line #35
		/* partial({'errors':0, 'deleted':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "deleted": 1})
		/* tbl.get(1).delete() */

		suite.T().Log("About to run line #35: tbl.Get(1).Delete()")

		runAndAssert(suite.Suite, expected_, tbl.Get(1).Delete(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #35")
	}

	{
		// changefeeds/point.yaml line #38
		/* [{'old_val':{'id':1,'update':1}, 'new_val':null}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1, "update": 1}, "new_val": nil}}
		/* fetch(basic, 1) */

		suite.T().Log("About to run line #38: fetch(basic, 1)")

		fetchAndAssert(suite.Suite, expected_, basic, 1)
		suite.T().Log("Finished running line #38")
	}

	// changefeeds/point.yaml line #49
	// filter = tbl.get(1).changes(squash=false,include_initial=True).filter(r.row['new_val']['update'].gt(2))['new_val']['update']
	suite.T().Log("Possibly executing: var filter r.Term = tbl.Get(1).Changes().OptArgs(r.ChangesOpts{Squash: false, IncludeInitial: true, }).Filter(r.Row.AtIndex('new_val').AtIndex('update').Gt(2)).AtIndex('new_val').AtIndex('update')")

	filter := maybeRun(tbl.Get(1).Changes().OptArgs(r.ChangesOpts{Squash: false, IncludeInitial: true}).Filter(r.Row.AtIndex("new_val").AtIndex("update").Gt(2)).AtIndex("new_val").AtIndex("update"), suite.session, r.RunOpts{})
	_ = filter // Prevent any noused variable errors

	{
		// changefeeds/point.yaml line #53
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* tbl.insert({'id':1, 'update':1}) */

		suite.T().Log("About to run line #53: tbl.Insert(map[interface{}]interface{}{'id': 1, 'update': 1, })")

		runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 1, "update": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #53")
	}

	{
		// changefeeds/point.yaml line #54
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* tbl.get(1).update({'update':4}) */

		suite.T().Log("About to run line #54: tbl.Get(1).Update(map[interface{}]interface{}{'update': 4, })")

		runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"update": 4}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #54")
	}

	{
		// changefeeds/point.yaml line #55
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* tbl.get(1).update({'update':1}) */

		suite.T().Log("About to run line #55: tbl.Get(1).Update(map[interface{}]interface{}{'update': 1, })")

		runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"update": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #55")
	}

	{
		// changefeeds/point.yaml line #56
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* tbl.get(1).update({'update':7}) */

		suite.T().Log("About to run line #56: tbl.Get(1).Update(map[interface{}]interface{}{'update': 7, })")

		runAndAssert(suite.Suite, expected_, tbl.Get(1).Update(map[interface{}]interface{}{"update": 7}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #56")
	}

	{
		// changefeeds/point.yaml line #58
		/* [4,7] */
		var expected_ []interface{} = []interface{}{4, 7}
		/* fetch(filter, 2) */

		suite.T().Log("About to run line #58: fetch(filter, 2)")

		fetchAndAssert(suite.Suite, expected_, filter, 2)
		suite.T().Log("Finished running line #58")
	}

	// changefeeds/point.yaml line #63
	// pluck = tbl.get(3).changes(squash=false,include_initial=True).pluck({'new_val':['red', 'blue']})['new_val']
	suite.T().Log("Possibly executing: var pluck r.Term = tbl.Get(3).Changes().OptArgs(r.ChangesOpts{Squash: false, IncludeInitial: true, }).Pluck(map[interface{}]interface{}{'new_val': []interface{}{'red', 'blue'}, }).AtIndex('new_val')")

	pluck := maybeRun(tbl.Get(3).Changes().OptArgs(r.ChangesOpts{Squash: false, IncludeInitial: true}).Pluck(map[interface{}]interface{}{"new_val": []interface{}{"red", "blue"}}).AtIndex("new_val"), suite.session, r.RunOpts{})
	_ = pluck // Prevent any noused variable errors

	{
		// changefeeds/point.yaml line #67
		/* partial({'errors':0, 'inserted':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 1})
		/* tbl.insert({'id':3, 'red':1, 'green':1}) */

		suite.T().Log("About to run line #67: tbl.Insert(map[interface{}]interface{}{'id': 3, 'red': 1, 'green': 1, })")

		runAndAssert(suite.Suite, expected_, tbl.Insert(map[interface{}]interface{}{"id": 3, "red": 1, "green": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #67")
	}

	{
		// changefeeds/point.yaml line #69
		/* partial({'errors':0, 'replaced':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1})
		/* tbl.get(3).update({'blue':2, 'green':3}) */

		suite.T().Log("About to run line #69: tbl.Get(3).Update(map[interface{}]interface{}{'blue': 2, 'green': 3, })")

		runAndAssert(suite.Suite, expected_, tbl.Get(3).Update(map[interface{}]interface{}{"blue": 2, "green": 3}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #69")
	}

	{
		// changefeeds/point.yaml line #71
		/* partial({'errors':0, 'replaced':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1})
		/* tbl.get(3).update({'green':4}) */

		suite.T().Log("About to run line #71: tbl.Get(3).Update(map[interface{}]interface{}{'green': 4, })")

		runAndAssert(suite.Suite, expected_, tbl.Get(3).Update(map[interface{}]interface{}{"green": 4}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #71")
	}

	{
		// changefeeds/point.yaml line #73
		/* partial({'errors':0, 'replaced':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1})
		/* tbl.get(3).update({'blue':4}) */

		suite.T().Log("About to run line #73: tbl.Get(3).Update(map[interface{}]interface{}{'blue': 4, })")

		runAndAssert(suite.Suite, expected_, tbl.Get(3).Update(map[interface{}]interface{}{"blue": 4}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #73")
	}

	{
		// changefeeds/point.yaml line #76
		/* [{'red': 1}, {'blue': 2, 'red': 1}, {'blue': 2, 'red': 1}, {'blue': 4, 'red': 1}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"red": 1}, map[interface{}]interface{}{"blue": 2, "red": 1}, map[interface{}]interface{}{"blue": 2, "red": 1}, map[interface{}]interface{}{"blue": 4, "red": 1}}
		/* fetch(pluck, 4) */

		suite.T().Log("About to run line #76: fetch(pluck, 4)")

		fetchAndAssert(suite.Suite, expected_, pluck, 4)
		suite.T().Log("Finished running line #76")
	}

	// changefeeds/point.yaml line #83
	// dtbl = r.db('rethinkdb').table('_debug_scratch')
	suite.T().Log("Possibly executing: var dtbl r.Term = r.DB('rethinkdb').Table('_debug_scratch')")

	dtbl := r.DB("rethinkdb").Table("_debug_scratch")
	_ = dtbl // Prevent any noused variable errors

	// changefeeds/point.yaml line #86
	// debug = dtbl.get(1).changes(include_initial=True)
	suite.T().Log("Possibly executing: var debug r.Term = dtbl.Get(1).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true, })")

	debug := maybeRun(dtbl.Get(1).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true}), suite.session, r.RunOpts{})
	_ = debug // Prevent any noused variable errors

	{
		// changefeeds/point.yaml line #88
		/* [{'new_val':null}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"new_val": nil}}
		/* fetch(debug, 1) */

		suite.T().Log("About to run line #88: fetch(debug, 1)")

		fetchAndAssert(suite.Suite, expected_, debug, 1)
		suite.T().Log("Finished running line #88")
	}

	{
		// changefeeds/point.yaml line #91
		/* partial({'errors':0, 'inserted':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "inserted": 1})
		/* dtbl.insert({'id':1}) */

		suite.T().Log("About to run line #91: dtbl.Insert(map[interface{}]interface{}{'id': 1, })")

		runAndAssert(suite.Suite, expected_, dtbl.Insert(map[interface{}]interface{}{"id": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #91")
	}

	{
		// changefeeds/point.yaml line #93
		/* [{'old_val':null, 'new_val':{'id':1}}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": nil, "new_val": map[interface{}]interface{}{"id": 1}}}
		/* fetch(debug, 1) */

		suite.T().Log("About to run line #93: fetch(debug, 1)")

		fetchAndAssert(suite.Suite, expected_, debug, 1)
		suite.T().Log("Finished running line #93")
	}

	{
		// changefeeds/point.yaml line #96
		/* partial({'errors':0, 'replaced':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1})
		/* dtbl.get(1).update({'update':1}) */

		suite.T().Log("About to run line #96: dtbl.Get(1).Update(map[interface{}]interface{}{'update': 1, })")

		runAndAssert(suite.Suite, expected_, dtbl.Get(1).Update(map[interface{}]interface{}{"update": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #96")
	}

	{
		// changefeeds/point.yaml line #98
		/* [{'old_val':{'id':1}, 'new_val':{'id':1,'update':1}}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1}, "new_val": map[interface{}]interface{}{"id": 1, "update": 1}}}
		/* fetch(debug, 1) */

		suite.T().Log("About to run line #98: fetch(debug, 1)")

		fetchAndAssert(suite.Suite, expected_, debug, 1)
		suite.T().Log("Finished running line #98")
	}

	{
		// changefeeds/point.yaml line #101
		/* partial({'errors':0, 'deleted':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "deleted": 1})
		/* dtbl.get(1).delete() */

		suite.T().Log("About to run line #101: dtbl.Get(1).Delete()")

		runAndAssert(suite.Suite, expected_, dtbl.Get(1).Delete(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #101")
	}

	{
		// changefeeds/point.yaml line #103
		/* [{'old_val':{'id':1,'update':1}, 'new_val':null}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"old_val": map[interface{}]interface{}{"id": 1, "update": 1}, "new_val": nil}}
		/* fetch(debug, 1) */

		suite.T().Log("About to run line #103: fetch(debug, 1)")

		fetchAndAssert(suite.Suite, expected_, debug, 1)
		suite.T().Log("Finished running line #103")
	}

	{
		// changefeeds/point.yaml line #106
		/* {'skipped':0, 'deleted':0, 'unchanged':0, 'errors':0, 'replaced':0, 'inserted':1} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"skipped": 0, "deleted": 0, "unchanged": 0, "errors": 0, "replaced": 0, "inserted": 1}
		/* dtbl.insert({'id':5, 'red':1, 'green':1}) */

		suite.T().Log("About to run line #106: dtbl.Insert(map[interface{}]interface{}{'id': 5, 'red': 1, 'green': 1, })")

		runAndAssert(suite.Suite, expected_, dtbl.Insert(map[interface{}]interface{}{"id": 5, "red": 1, "green": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #106")
	}

	// changefeeds/point.yaml line #108
	// dtblPluck = dtbl.get(5).changes(include_initial=True).pluck({'new_val':['red', 'blue']})['new_val']
	suite.T().Log("Possibly executing: var dtblPluck r.Term = dtbl.Get(5).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true, }).Pluck(map[interface{}]interface{}{'new_val': []interface{}{'red', 'blue'}, }).AtIndex('new_val')")

	dtblPluck := maybeRun(dtbl.Get(5).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true}).Pluck(map[interface{}]interface{}{"new_val": []interface{}{"red", "blue"}}).AtIndex("new_val"), suite.session, r.RunOpts{})
	_ = dtblPluck // Prevent any noused variable errors

	{
		// changefeeds/point.yaml line #113
		/* [{'red':1}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"red": 1}}
		/* fetch(dtblPluck, 1) */

		suite.T().Log("About to run line #113: fetch(dtblPluck, 1)")

		fetchAndAssert(suite.Suite, expected_, dtblPluck, 1)
		suite.T().Log("Finished running line #113")
	}

	{
		// changefeeds/point.yaml line #116
		/* partial({'errors':0, 'replaced':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"errors": 0, "replaced": 1})
		/* dtbl.get(5).update({'blue':2, 'green':3}) */

		suite.T().Log("About to run line #116: dtbl.Get(5).Update(map[interface{}]interface{}{'blue': 2, 'green': 3, })")

		runAndAssert(suite.Suite, expected_, dtbl.Get(5).Update(map[interface{}]interface{}{"blue": 2, "green": 3}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #116")
	}

	{
		// changefeeds/point.yaml line #119
		/* [{'blue':2, 'red':1}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"blue": 2, "red": 1}}
		/* fetch(dtblPluck, 1) */

		suite.T().Log("About to run line #119: fetch(dtblPluck, 1)")

		fetchAndAssert(suite.Suite, expected_, dtblPluck, 1)
		suite.T().Log("Finished running line #119")
	}

	// changefeeds/point.yaml line #132
	// tableId = tbl.info()['id']
	suite.T().Log("Possibly executing: var tableId r.Term = tbl.Info().AtIndex('id')")

	tableId := maybeRun(tbl.Info().AtIndex("id"), suite.session, r.RunOpts{})
	_ = tableId // Prevent any noused variable errors

	// changefeeds/point.yaml line #136
	// rtblPluck = r.db('rethinkdb').table('table_status').get(tableId).changes(include_initial=True)
	suite.T().Log("Possibly executing: var rtblPluck r.Term = r.DB('rethinkdb').Table('table_status').Get(tableId).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true, })")

	rtblPluck := maybeRun(r.DB("rethinkdb").Table("table_status").Get(tableId).Changes().OptArgs(r.ChangesOpts{IncludeInitial: true}), suite.session, r.RunOpts{})
	_ = rtblPluck // Prevent any noused variable errors

	{
		// changefeeds/point.yaml line #137
		/* partial([{'new_val':partial({'db':'test'})}]) */
		var expected_ compare.Expected = compare.PartialMatch([]interface{}{map[interface{}]interface{}{"new_val": compare.PartialMatch(map[interface{}]interface{}{"db": "test"})}})
		/* fetch(rtblPluck, 1) */

		suite.T().Log("About to run line #137: fetch(rtblPluck, 1)")

		fetchAndAssert(suite.Suite, expected_, rtblPluck, 1)
		suite.T().Log("Finished running line #137")
	}

	{
		// changefeeds/point.yaml line #140
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* tbl.reconfigure(shards=3, replicas=1) */

		suite.T().Log("About to run line #140: tbl.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 3, Replicas: 1, })")

		runAndAssert(suite.Suite, expected_, tbl.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 3, Replicas: 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #140")
	}

	{
		// changefeeds/point.yaml line #143
		/* partial([{'old_val':partial({'db':'test'}), 'new_val':partial({'db':'test'})}]) */
		var expected_ compare.Expected = compare.PartialMatch([]interface{}{map[interface{}]interface{}{"old_val": compare.PartialMatch(map[interface{}]interface{}{"db": "test"}), "new_val": compare.PartialMatch(map[interface{}]interface{}{"db": "test"})}})
		/* fetch(rtblPluck, 1, 2) */

		suite.T().Log("About to run line #143: fetch(rtblPluck, 1)")

		fetchAndAssert(suite.Suite, expected_, rtblPluck, 1)
		suite.T().Log("Finished running line #143")
	}
}
Exemplo n.º 24
0
func (suite *PolymorphismSuite) TestCases() {
	suite.T().Log("Running PolymorphismSuite: Tests that manipulation data in tables")

	tbl := r.DB("test").Table("tbl")
	_ = tbl // Prevent any noused variable errors

	// polymorphism.yaml line #5
	// obj = r.expr({'id':0,'a':0})
	suite.T().Log("Possibly executing: var obj r.Term = r.Expr(map[interface{}]interface{}{'id': 0, 'a': 0, })")

	obj := r.Expr(map[interface{}]interface{}{"id": 0, "a": 0})
	_ = obj // Prevent any noused variable errors

	{
		// polymorphism.yaml line #7
		/* ({'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':3}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 3}
		/* tbl.insert([{'id':i, 'a':i} for i in xrange(3)]) */

		suite.T().Log("About to run line #7: tbl.Insert((func() []interface{} {\n    res := []interface{}{}\n    for iterator_ := 0; iterator_ < 3; iterator_++ {\n        i := iterator_\n        res = append(res, map[interface{}]interface{}{'id': i, 'a': i, })\n    }\n    return res\n}()))")

		runAndAssert(suite.Suite, expected_, tbl.Insert((func() []interface{} {
			res := []interface{}{}
			for iterator_ := 0; iterator_ < 3; iterator_++ {
				i := iterator_
				res = append(res, map[interface{}]interface{}{"id": i, "a": i})
			}
			return res
		}())), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #7")
	}

	{
		// polymorphism.yaml line #21
		/* ({'id':0,'c':1,'a':0}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "c": 1, "a": 0}
		/* tbl.merge({'c':1}).nth(0) */

		suite.T().Log("About to run line #21: tbl.Merge(map[interface{}]interface{}{'c': 1, }).Nth(0)")

		runAndAssert(suite.Suite, expected_, tbl.Merge(map[interface{}]interface{}{"c": 1}).Nth(0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #21")
	}

	{
		// polymorphism.yaml line #22
		/* ({'id':0,'c':1,'a':0}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0, "c": 1, "a": 0}
		/* obj.merge({'c':1}) */

		suite.T().Log("About to run line #22: obj.Merge(map[interface{}]interface{}{'c': 1, })")

		runAndAssert(suite.Suite, expected_, obj.Merge(map[interface{}]interface{}{"c": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #22")
	}

	{
		// polymorphism.yaml line #26
		/* ({'id':0}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0}
		/* tbl.without('a').nth(0) */

		suite.T().Log("About to run line #26: tbl.Without('a').Nth(0)")

		runAndAssert(suite.Suite, expected_, tbl.Without("a").Nth(0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #26")
	}

	{
		// polymorphism.yaml line #27
		/* ({'id':0}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"id": 0}
		/* obj.without('a') */

		suite.T().Log("About to run line #27: obj.Without('a')")

		runAndAssert(suite.Suite, expected_, obj.Without("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #27")
	}

	{
		// polymorphism.yaml line #31
		/* ({'a':0}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 0}
		/* tbl.pluck('a').nth(0) */

		suite.T().Log("About to run line #31: tbl.Pluck('a').Nth(0)")

		runAndAssert(suite.Suite, expected_, tbl.Pluck("a").Nth(0), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #31")
	}

	{
		// polymorphism.yaml line #32
		/* ({'a':0}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 0}
		/* obj.pluck('a') */

		suite.T().Log("About to run line #32: obj.Pluck('a')")

		runAndAssert(suite.Suite, expected_, obj.Pluck("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #32")
	}
}
Exemplo n.º 25
0
func (suite *MetaTableSuite) TestCases() {
	suite.T().Log("Running MetaTableSuite: Tests meta queries for creating and deleting tables")

	// meta/table.yaml line #4
	// db = r.db('test')
	suite.T().Log("Possibly executing: var db r.Term = r.DB('test')")

	db := r.DB("test")
	_ = db // Prevent any noused variable errors

	{
		// meta/table.yaml line #6
		/* [] */
		var expected_ []interface{} = []interface{}{}
		/* db.table_list() */

		suite.T().Log("About to run line #6: db.TableList()")

		runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #6")
	}

	{
		// meta/table.yaml line #9
		/* ({'type':'DB','name':'rethinkdb','id':null}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"type": "DB", "name": "rethinkdb", "id": nil}
		/* r.db('rethinkdb').info() */

		suite.T().Log("About to run line #9: r.DB('rethinkdb').Info()")

		runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Info(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #9")
	}

	{
		// meta/table.yaml line #12
		/* partial({'db':{'type':'DB','name':'rethinkdb','id':null},
		'type':'TABLE','id':null,'name':'stats',
		'indexes':[],'primary_key':'id'}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"db": map[interface{}]interface{}{"type": "DB", "name": "rethinkdb", "id": nil}, "type": "TABLE", "id": nil, "name": "stats", "indexes": []interface{}{}, "primary_key": "id"})
		/* r.db('rethinkdb').table('stats').info() */

		suite.T().Log("About to run line #12: r.DB('rethinkdb').Table('stats').Info()")

		runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("stats").Info(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #12")
	}

	{
		// meta/table.yaml line #18
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* db.table_create('a') */

		suite.T().Log("About to run line #18: db.TableCreate('a')")

		runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #18")
	}

	{
		// meta/table.yaml line #21
		/* ['a'] */
		var expected_ []interface{} = []interface{}{"a"}
		/* db.table_list() */

		suite.T().Log("About to run line #21: db.TableList()")

		runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #21")
	}

	{
		// meta/table.yaml line #24
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* db.table_create('b') */

		suite.T().Log("About to run line #24: db.TableCreate('b')")

		runAndAssert(suite.Suite, expected_, db.TableCreate("b"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #24")
	}

	{
		// meta/table.yaml line #27
		/* bag(['a', 'b']) */
		var expected_ compare.Expected = compare.UnorderedMatch([]interface{}{"a", "b"})
		/* db.table_list() */

		suite.T().Log("About to run line #27: db.TableList()")

		runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #27")
	}

	{
		// meta/table.yaml line #31
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('a') */

		suite.T().Log("About to run line #31: db.TableDrop('a')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #31")
	}

	{
		// meta/table.yaml line #34
		/* ['b'] */
		var expected_ []interface{} = []interface{}{"b"}
		/* db.table_list() */

		suite.T().Log("About to run line #34: db.TableList()")

		runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #34")
	}

	{
		// meta/table.yaml line #37
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('b') */

		suite.T().Log("About to run line #37: db.TableDrop('b')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("b"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #37")
	}

	{
		// meta/table.yaml line #40
		/* [] */
		var expected_ []interface{} = []interface{}{}
		/* db.table_list() */

		suite.T().Log("About to run line #40: db.TableList()")

		runAndAssert(suite.Suite, expected_, db.TableList(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #40")
	}

	{
		// meta/table.yaml line #44
		/* partial({'tables_created':1,'config_changes':[partial({'new_val':partial({'durability':'soft'})})]}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1, "config_changes": []interface{}{compare.PartialMatch(map[interface{}]interface{}{"new_val": compare.PartialMatch(map[interface{}]interface{}{"durability": "soft"})})}})
		/* db.table_create('ab', durability='soft') */

		suite.T().Log("About to run line #44: db.TableCreate('ab').OptArgs(r.TableCreateOpts{Durability: 'soft', })")

		runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{Durability: "soft"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #44")
	}

	{
		// meta/table.yaml line #49
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('ab') */

		suite.T().Log("About to run line #49: db.TableDrop('ab')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #49")
	}

	{
		// meta/table.yaml line #52
		/* partial({'tables_created':1,'config_changes':[partial({'new_val':partial({'durability':'hard'})})]}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1, "config_changes": []interface{}{compare.PartialMatch(map[interface{}]interface{}{"new_val": compare.PartialMatch(map[interface{}]interface{}{"durability": "hard"})})}})
		/* db.table_create('ab', durability='hard') */

		suite.T().Log("About to run line #52: db.TableCreate('ab').OptArgs(r.TableCreateOpts{Durability: 'hard', })")

		runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{Durability: "hard"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #52")
	}

	{
		// meta/table.yaml line #57
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('ab') */

		suite.T().Log("About to run line #57: db.TableDrop('ab')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #57")
	}

	{
		// meta/table.yaml line #60
		/* err('ReqlQueryLogicError', 'Durability option `fake` unrecognized (options are "hard" and "soft").') */
		var expected_ Err = err("ReqlQueryLogicError", "Durability option `fake` unrecognized (options are \"hard\" and \"soft\").")
		/* db.table_create('ab', durability='fake') */

		suite.T().Log("About to run line #60: db.TableCreate('ab').OptArgs(r.TableCreateOpts{Durability: 'fake', })")

		runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{Durability: "fake"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #60")
	}

	{
		// meta/table.yaml line #65
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* db.table_create('ab', primary_key='bar', shards=2, replicas=1) */

		suite.T().Log("About to run line #65: db.TableCreate('ab').OptArgs(r.TableCreateOpts{PrimaryKey: 'bar', Shards: 2, Replicas: 1, })")

		runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{PrimaryKey: "bar", Shards: 2, Replicas: 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #65")
	}

	{
		// meta/table.yaml line #70
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('ab') */

		suite.T().Log("About to run line #70: db.TableDrop('ab')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #70")
	}

	{
		// meta/table.yaml line #73
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* db.table_create('ab', primary_key='bar', primary_replica_tag='default') */

		suite.T().Log("About to run line #73: db.TableCreate('ab').OptArgs(r.TableCreateOpts{PrimaryKey: 'bar', PrimaryReplicaTag: 'default', })")

		runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{PrimaryKey: "bar", PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #73")
	}

	{
		// meta/table.yaml line #78
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('ab') */

		suite.T().Log("About to run line #78: db.TableDrop('ab')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #78")
	}

	{
		// meta/table.yaml line #81
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* db.table_create('ab', nonvoting_replica_tags=['default']) */

		suite.T().Log("About to run line #81: db.TableCreate('ab').OptArgs(r.TableCreateOpts{NonVotingReplicaTags: []interface{}{'default'}, })")

		runAndAssert(suite.Suite, expected_, db.TableCreate("ab").OptArgs(r.TableCreateOpts{NonVotingReplicaTags: []interface{}{"default"}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #81")
	}

	{
		// meta/table.yaml line #86
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('ab') */

		suite.T().Log("About to run line #86: db.TableDrop('ab')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("ab"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #86")
	}

	{
		// meta/table.yaml line #90
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* db.table_create('a') */

		suite.T().Log("About to run line #90: db.TableCreate('a')")

		runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #90")
	}

	{
		// meta/table.yaml line #93
		/* partial({'reconfigured':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1})
		/* db.table('a').reconfigure(shards=1, replicas=1) */

		suite.T().Log("About to run line #93: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1, })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #93")
	}

	{
		// meta/table.yaml line #98
		/* partial({'reconfigured':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1})
		/* db.table('a').reconfigure(shards=1, replicas={"default":1}, nonvoting_replica_tags=['default'], primary_replica_tag='default') */

		suite.T().Log("About to run line #98: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 1, }, NonVotingReplicaTags: []interface{}{'default'}, PrimaryReplicaTag: 'default', })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 1}, NonVotingReplicaTags: []interface{}{"default"}, PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #98")
	}

	{
		// meta/table.yaml line #103
		/* partial({'reconfigured':0}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 0})
		/* db.table('a').reconfigure(shards=1, replicas=1, dry_run=True) */

		suite.T().Log("About to run line #103: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1, DryRun: true, })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 1, DryRun: true}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #103")
	}

	{
		// meta/table.yaml line #108
		/* err('ReqlOpFailedError', 'This table doesn\'t need to be repaired.', []) */
		var expected_ Err = err("ReqlOpFailedError", "This table doesn't need to be repaired.")
		/* db.table('a').reconfigure(emergency_repair="unsafe_rollback") */

		suite.T().Log("About to run line #108: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #108")
	}

	{
		// meta/table.yaml line #113
		/* err('ReqlOpFailedError', 'This table doesn\'t need to be repaired.', []) */
		var expected_ Err = err("ReqlOpFailedError", "This table doesn't need to be repaired.")
		/* db.table('a').reconfigure(emergency_repair="unsafe_rollback", dry_run=True) */

		suite.T().Log("About to run line #113: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', DryRun: true, })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback", DryRun: true}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #113")
	}

	{
		// meta/table.yaml line #118
		/* err('ReqlOpFailedError', 'This table doesn\'t need to be repaired.', []) */
		var expected_ Err = err("ReqlOpFailedError", "This table doesn't need to be repaired.")
		/* db.table('a').reconfigure(emergency_repair="unsafe_rollback_or_erase") */

		suite.T().Log("About to run line #118: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback_or_erase', })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback_or_erase"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #118")
	}

	{
		// meta/table.yaml line #123
		/* partial({'reconfigured':0}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 0})
		/* db.table('a').reconfigure(emergency_repair=None, shards=1, replicas=1, dry_run=True) */

		suite.T().Log("About to run line #123: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: nil, Shards: 1, Replicas: 1, DryRun: true, })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: nil, Shards: 1, Replicas: 1, DryRun: true}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #123")
	}

	{
		// meta/table.yaml line #128
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('a') */

		suite.T().Log("About to run line #128: db.TableDrop('a')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #128")
	}

	{
		// meta/table.yaml line #132
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* db.table_create('foo') */

		suite.T().Log("About to run line #132: db.TableCreate('foo')")

		runAndAssert(suite.Suite, expected_, db.TableCreate("foo"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #132")
	}

	{
		// meta/table.yaml line #135
		/* err('ReqlOpFailedError', 'Table `test.foo` already exists.', [0]) */
		var expected_ Err = err("ReqlOpFailedError", "Table `test.foo` already exists.")
		/* db.table_create('foo') */

		suite.T().Log("About to run line #135: db.TableCreate('foo')")

		runAndAssert(suite.Suite, expected_, db.TableCreate("foo"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #135")
	}

	{
		// meta/table.yaml line #138
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('foo') */

		suite.T().Log("About to run line #138: db.TableDrop('foo')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("foo"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #138")
	}

	{
		// meta/table.yaml line #141
		/* err('ReqlOpFailedError', 'Table `test.foo` does not exist.', [0]) */
		var expected_ Err = err("ReqlOpFailedError", "Table `test.foo` does not exist.")
		/* db.table_drop('foo') */

		suite.T().Log("About to run line #141: db.TableDrop('foo')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("foo"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #141")
	}

	{
		// meta/table.yaml line #158
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* db.table_create('a') */

		suite.T().Log("About to run line #158: db.TableCreate('a')")

		runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #158")
	}

	{
		// meta/table.yaml line #161
		/* err('ReqlQueryLogicError', 'Every table must have at least one shard.', []) */
		var expected_ Err = err("ReqlQueryLogicError", "Every table must have at least one shard.")
		/* db.table('a').reconfigure(shards=0, replicas=1) */

		suite.T().Log("About to run line #161: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1, })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #161")
	}

	{
		// meta/table.yaml line #166
		/* err('ReqlOpFailedError', 'Can\'t use server tag `foo` for primary replicas because you specified no replicas in server tag `foo`.', []) */
		var expected_ Err = err("ReqlOpFailedError", "Can't use server tag `foo` for primary replicas because you specified no replicas in server tag `foo`.")
		/* db.table('a').reconfigure(shards=1, replicas={"default":1}, primary_replica_tag="foo") */

		suite.T().Log("About to run line #166: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 1, }, PrimaryReplicaTag: 'foo', })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 1}, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #166")
	}

	{
		// meta/table.yaml line #171
		/* err('ReqlOpFailedError', 'You specified that the replicas in server tag `foo` should be non-voting, but you didn\'t specify a number of replicas in server tag `foo`.', []) */
		var expected_ Err = err("ReqlOpFailedError", "You specified that the replicas in server tag `foo` should be non-voting, but you didn't specify a number of replicas in server tag `foo`.")
		/* db.table('a').reconfigure(shards=1, replicas={"default":1}, primary_replica_tag="default", nonvoting_replica_tags=["foo"]) */

		suite.T().Log("About to run line #171: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 1, }, PrimaryReplicaTag: 'default', NonVotingReplicaTags: []interface{}{'foo'}, })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 1}, PrimaryReplicaTag: "default", NonVotingReplicaTags: []interface{}{"foo"}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #171")
	}

	{
		// meta/table.yaml line #176
		/* err('ReqlOpFailedError', 'You must set `replicas` to at least one. `replicas` includes the primary replica; if there are zero replicas, there is nowhere to put the data.', []) */
		var expected_ Err = err("ReqlOpFailedError", "You must set `replicas` to at least one. `replicas` includes the primary replica; if there are zero replicas, there is nowhere to put the data.")
		/* db.table('a').reconfigure(shards=1, replicas={"foo":0}, primary_replica_tag="foo") */

		suite.T().Log("About to run line #176: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'foo': 0, }, PrimaryReplicaTag: 'foo', })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"foo": 0}, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #176")
	}

	{
		// meta/table.yaml line #181
		/* err('ReqlQueryLogicError', '`primary_replica_tag` must be specified when `replicas` is an OBJECT.', []) */
		var expected_ Err = err("ReqlQueryLogicError", "`primary_replica_tag` must be specified when `replicas` is an OBJECT.")
		/* db.table('a').reconfigure(shards=1, replicas={"default":0}) */

		suite.T().Log("About to run line #181: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 0, }, })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 0}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #181")
	}

	{
		// meta/table.yaml line #186
		/* err('ReqlQueryLogicError', 'Can\'t have a negative number of replicas', []) */
		var expected_ Err = err("ReqlQueryLogicError", "Can't have a negative number of replicas")
		/* db.table('a').reconfigure(shards=1, replicas={"default":-3}, primary_replica_tag='default') */

		suite.T().Log("About to run line #186: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': -3, }, PrimaryReplicaTag: 'default', })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": -3}, PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #186")
	}

	{
		// meta/table.yaml line #191
		/* err('ReqlQueryLogicError', '`replicas` must be an OBJECT if `primary_replica_tag` is specified.', []) */
		var expected_ Err = err("ReqlQueryLogicError", "`replicas` must be an OBJECT if `primary_replica_tag` is specified.")
		/* db.table('a').reconfigure(shards=1, replicas=3, primary_replica_tag='foo') */

		suite.T().Log("About to run line #191: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: 'foo', })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #191")
	}

	{
		// meta/table.yaml line #196
		/* err('ReqlQueryLogicError', '`replicas` must be an OBJECT if `nonvoting_replica_tags` is specified.', []) */
		var expected_ Err = err("ReqlQueryLogicError", "`replicas` must be an OBJECT if `nonvoting_replica_tags` is specified.")
		/* db.table('a').reconfigure(shards=1, replicas=3, nonvoting_replica_tags=['foo']) */

		suite.T().Log("About to run line #196: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, NonVotingReplicaTags: []interface{}{'foo'}, })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, NonVotingReplicaTags: []interface{}{"foo"}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #196")
	}

	{
		// meta/table.yaml line #201
		/* err('ReqlQueryLogicError', 'Can\'t emergency repair an entire database at once; instead you should run `reconfigure()` on each table individually.') */
		var expected_ Err = err("ReqlQueryLogicError", "Can't emergency repair an entire database at once; instead you should run `reconfigure()` on each table individually.")
		/* db.reconfigure(emergency_repair="unsafe_rollback") */

		suite.T().Log("About to run line #201: db.Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', })")

		runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #201")
	}

	{
		// meta/table.yaml line #206
		/* err('ReqlQueryLogicError', '`emergency_repair` should be "unsafe_rollback" or "unsafe_rollback_or_erase"', []) */
		var expected_ Err = err("ReqlQueryLogicError", "`emergency_repair` should be \"unsafe_rollback\" or \"unsafe_rollback_or_erase\"")
		/* db.table('a').reconfigure(emergency_repair="foo") */

		suite.T().Log("About to run line #206: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'foo', })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "foo"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #206")
	}

	{
		// meta/table.yaml line #211
		/* err('ReqlQueryLogicError', 'In emergency repair mode, you can\'t specify shards, replicas, etc.') */
		var expected_ Err = err("ReqlQueryLogicError", "In emergency repair mode, you can't specify shards, replicas, etc.")
		/* db.table('a').reconfigure(emergency_repair="unsafe_rollback", shards=1, replicas=1) */

		suite.T().Log("About to run line #211: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: 'unsafe_rollback', Shards: 1, Replicas: 1, })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{EmergencyRepair: "unsafe_rollback", Shards: 1, Replicas: 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #211")
	}

	{
		// meta/table.yaml line #217
		/* partial({'reconfigured':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1})
		/* db.table('a').reconfigure(shards=2, replicas=1) */

		suite.T().Log("About to run line #217: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1, })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #217")
	}

	{
		// meta/table.yaml line #222
		/* {"ready":1} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"ready": 1}
		/* db.table('a').wait(wait_for="all_replicas_ready") */

		suite.T().Log("About to run line #222: db.Table('a').Wait().OptArgs(r.WaitOpts{WaitFor: 'all_replicas_ready', })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Wait().OptArgs(r.WaitOpts{WaitFor: "all_replicas_ready"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #222")
	}

	{
		// meta/table.yaml line #228
		/* partial({"inserted":4}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"inserted": 4})
		/* db.table('a').insert([{"id":1}, {"id":2}, {"id":3}, {"id":4}]) */

		suite.T().Log("About to run line #228: db.Table('a').Insert([]interface{}{map[interface{}]interface{}{'id': 1, }, map[interface{}]interface{}{'id': 2, }, map[interface{}]interface{}{'id': 3, }, map[interface{}]interface{}{'id': 4, }})")

		runAndAssert(suite.Suite, expected_, db.Table("a").Insert([]interface{}{map[interface{}]interface{}{"id": 1}, map[interface{}]interface{}{"id": 2}, map[interface{}]interface{}{"id": 3}, map[interface{}]interface{}{"id": 4}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #228")
	}

	{
		// meta/table.yaml line #233
		/* partial({'reconfigured':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 1})
		/* db.table('a').reconfigure(shards=2, replicas=1) */

		suite.T().Log("About to run line #233: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1, })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #233")
	}

	{
		// meta/table.yaml line #238
		/* err('ReqlOpFailedError', 'Can\'t put 2 replicas on servers with the tag `default` because there are only 1 servers with the tag `default`. It\'s impossible to have more replicas of the data than there are servers.', []) */
		var expected_ Err = err("ReqlOpFailedError", "Can't put 2 replicas on servers with the tag `default` because there are only 1 servers with the tag `default`. It's impossible to have more replicas of the data than there are servers.")
		/* db.table('a').reconfigure(shards=1, replicas=2) */

		suite.T().Log("About to run line #238: db.Table('a').Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 2, })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 2}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #238")
	}

	{
		// meta/table.yaml line #244
		/* {"ready":1} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"ready": 1}
		/* db.table('a').wait(wait_for="all_replicas_ready") */

		suite.T().Log("About to run line #244: db.Table('a').Wait().OptArgs(r.WaitOpts{WaitFor: 'all_replicas_ready', })")

		runAndAssert(suite.Suite, expected_, db.Table("a").Wait().OptArgs(r.WaitOpts{WaitFor: "all_replicas_ready"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #244")
	}

	{
		// meta/table.yaml line #248
		/* partial({'rebalanced':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"rebalanced": 1})
		/* db.table('a').rebalance() */

		suite.T().Log("About to run line #248: db.Table('a').Rebalance()")

		runAndAssert(suite.Suite, expected_, db.Table("a").Rebalance(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #248")
	}

	{
		// meta/table.yaml line #251
		/* {"ready":1} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"ready": 1}
		/* db.wait(wait_for="all_replicas_ready") */

		suite.T().Log("About to run line #251: db.Wait().OptArgs(r.WaitOpts{WaitFor: 'all_replicas_ready', })")

		runAndAssert(suite.Suite, expected_, db.Wait().OptArgs(r.WaitOpts{WaitFor: "all_replicas_ready"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #251")
	}

	{
		// meta/table.yaml line #255
		/* partial({'rebalanced':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"rebalanced": 1})
		/* db.rebalance() */

		suite.T().Log("About to run line #255: db.Rebalance()")

		runAndAssert(suite.Suite, expected_, db.Rebalance(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #255")
	}

	{
		// meta/table.yaml line #271
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('a') */

		suite.T().Log("About to run line #271: db.TableDrop('a')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #271")
	}

	{
		// meta/table.yaml line #275
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* db.table_create('a') */

		suite.T().Log("About to run line #275: db.TableCreate('a')")

		runAndAssert(suite.Suite, expected_, db.TableCreate("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #275")
	}

	{
		// meta/table.yaml line #276
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* db.table_create('b') */

		suite.T().Log("About to run line #276: db.TableCreate('b')")

		runAndAssert(suite.Suite, expected_, db.TableCreate("b"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #276")
	}

	{
		// meta/table.yaml line #277
		/* AnythingIsFine */
		var expected_ string = compare.AnythingIsFine
		/* db.table_create('c') */

		suite.T().Log("About to run line #277: db.TableCreate('c')")

		runAndAssert(suite.Suite, expected_, db.TableCreate("c"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #277")
	}

	{
		// meta/table.yaml line #279
		/* err('ReqlQueryLogicError', 'Every table must have at least one shard.', []) */
		var expected_ Err = err("ReqlQueryLogicError", "Every table must have at least one shard.")
		/* db.reconfigure(shards=0, replicas=1) */

		suite.T().Log("About to run line #279: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1, })")

		runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 0, Replicas: 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #279")
	}

	{
		// meta/table.yaml line #284
		/* err('ReqlQueryLogicError', '`primary_replica_tag` must be specified when `replicas` is an OBJECT.', []) */
		var expected_ Err = err("ReqlQueryLogicError", "`primary_replica_tag` must be specified when `replicas` is an OBJECT.")
		/* db.reconfigure(shards=1, replicas={"default":0}) */

		suite.T().Log("About to run line #284: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': 0, }, })")

		runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": 0}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #284")
	}

	{
		// meta/table.yaml line #289
		/* err('ReqlQueryLogicError', 'Can\'t have a negative number of replicas', []) */
		var expected_ Err = err("ReqlQueryLogicError", "Can't have a negative number of replicas")
		/* db.reconfigure(shards=1, replicas={"default":-3}, primary_replica_tag='default') */

		suite.T().Log("About to run line #289: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{'default': -3, }, PrimaryReplicaTag: 'default', })")

		runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: map[interface{}]interface{}{"default": -3}, PrimaryReplicaTag: "default"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #289")
	}

	{
		// meta/table.yaml line #294
		/* err('ReqlQueryLogicError', '`replicas` must be an OBJECT if `primary_replica_tag` is specified.', []) */
		var expected_ Err = err("ReqlQueryLogicError", "`replicas` must be an OBJECT if `primary_replica_tag` is specified.")
		/* db.reconfigure(shards=1, replicas=3, primary_replica_tag='foo') */

		suite.T().Log("About to run line #294: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: 'foo', })")

		runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 1, Replicas: 3, PrimaryReplicaTag: "foo"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #294")
	}

	{
		// meta/table.yaml line #299
		/* partial({'reconfigured':3}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"reconfigured": 3})
		/* db.reconfigure(shards=2, replicas=1) */

		suite.T().Log("About to run line #299: db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1, })")

		runAndAssert(suite.Suite, expected_, db.Reconfigure().OptArgs(r.ReconfigureOpts{Shards: 2, Replicas: 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #299")
	}

	{
		// meta/table.yaml line #304
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('a') */

		suite.T().Log("About to run line #304: db.TableDrop('a')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("a"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #304")
	}

	{
		// meta/table.yaml line #306
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('b') */

		suite.T().Log("About to run line #306: db.TableDrop('b')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("b"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #306")
	}

	{
		// meta/table.yaml line #308
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('c') */

		suite.T().Log("About to run line #308: db.TableDrop('c')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("c"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #308")
	}

	{
		// meta/table.yaml line #312
		/* partial({'dbs_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_created": 1})
		/* r.db_create("test2") */

		suite.T().Log("About to run line #312: r.DBCreate('test2')")

		runAndAssert(suite.Suite, expected_, r.DBCreate("test2"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #312")
	}

	// meta/table.yaml line #315
	// db2 = r.db("test2")
	suite.T().Log("Possibly executing: var db2 r.Term = r.DB('test2')")

	db2 := r.DB("test2")
	_ = db2 // Prevent any noused variable errors

	{
		// meta/table.yaml line #317
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* db.table_create("testA") */

		suite.T().Log("About to run line #317: db.TableCreate('testA')")

		runAndAssert(suite.Suite, expected_, db.TableCreate("testA"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #317")
	}

	{
		// meta/table.yaml line #319
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* db.table_create("testB") */

		suite.T().Log("About to run line #319: db.TableCreate('testB')")

		runAndAssert(suite.Suite, expected_, db.TableCreate("testB"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #319")
	}

	{
		// meta/table.yaml line #321
		/* partial({'tables_created':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_created": 1})
		/* db2.table_create("test2B") */

		suite.T().Log("About to run line #321: db2.TableCreate('test2B')")

		runAndAssert(suite.Suite, expected_, db2.TableCreate("test2B"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #321")
	}

	{
		// meta/table.yaml line #324
		/* {'db':'test','name':'testA'} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"db": "test", "name": "testA"}
		/* r.table('testA').config().pluck('db','name') */

		suite.T().Log("About to run line #324: r.Table('testA').Config().Pluck('db', 'name')")

		runAndAssert(suite.Suite, expected_, r.Table("testA").Config().Pluck("db", "name"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #324")
	}

	{
		// meta/table.yaml line #327
		/* err('ReqlOpFailedError', 'Table `test.doesntexist` does not exist.', []) */
		var expected_ Err = err("ReqlOpFailedError", "Table `test.doesntexist` does not exist.")
		/* r.table('doesntexist').config() */

		suite.T().Log("About to run line #327: r.Table('doesntexist').Config()")

		runAndAssert(suite.Suite, expected_, r.Table("doesntexist").Config(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #327")
	}

	{
		// meta/table.yaml line #330
		/* err('ReqlOpFailedError', 'Table `test.test2B` does not exist.', []) */
		var expected_ Err = err("ReqlOpFailedError", "Table `test.test2B` does not exist.")
		/* r.table('test2B').config() */

		suite.T().Log("About to run line #330: r.Table('test2B').Config()")

		runAndAssert(suite.Suite, expected_, r.Table("test2B").Config(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #330")
	}

	{
		// meta/table.yaml line #333
		/* True */
		var expected_ bool = true
		/* r.db('rethinkdb').table('table_config').filter({'name':'testA'}).nth(0).eq(r.table('testA').config()) */

		suite.T().Log("About to run line #333: r.DB('rethinkdb').Table('table_config').Filter(map[interface{}]interface{}{'name': 'testA', }).Nth(0).Eq(r.Table('testA').Config())")

		runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("table_config").Filter(map[interface{}]interface{}{"name": "testA"}).Nth(0).Eq(r.Table("testA").Config()), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #333")
	}

	{
		// meta/table.yaml line #336
		/* True */
		var expected_ bool = true
		/* r.db('rethinkdb').table('table_status').filter({'name':'testA'}).nth(0).eq(r.table('testA').status()) */

		suite.T().Log("About to run line #336: r.DB('rethinkdb').Table('table_status').Filter(map[interface{}]interface{}{'name': 'testA', }).Nth(0).Eq(r.Table('testA').Status())")

		runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("table_status").Filter(map[interface{}]interface{}{"name": "testA"}).Nth(0).Eq(r.Table("testA").Status()), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #336")
	}

	{
		// meta/table.yaml line #339
		/* uuid() */
		var expected_ compare.Regex = compare.IsUUID()
		/* r.db('rethinkdb').table('table_config', identifier_format='uuid').nth(0)["db"] */

		suite.T().Log("About to run line #339: r.DB('rethinkdb').Table('table_config').OptArgs(r.TableOpts{IdentifierFormat: 'uuid', }).Nth(0).AtIndex('db')")

		runAndAssert(suite.Suite, expected_, r.DB("rethinkdb").Table("table_config").OptArgs(r.TableOpts{IdentifierFormat: "uuid"}).Nth(0).AtIndex("db"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #339")
	}

	{
		// meta/table.yaml line #344
		/* 0 */
		var expected_ int = 0
		/* r.table('testA', identifier_format='uuid').count() */

		suite.T().Log("About to run line #344: r.Table('testA').OptArgs(r.TableOpts{IdentifierFormat: 'uuid', }).Count()")

		runAndAssert(suite.Suite, expected_, r.Table("testA").OptArgs(r.TableOpts{IdentifierFormat: "uuid"}).Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #344")
	}

	{
		// meta/table.yaml line #358
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('testA') */

		suite.T().Log("About to run line #358: db.TableDrop('testA')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("testA"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #358")
	}

	{
		// meta/table.yaml line #361
		/* partial({'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"tables_dropped": 1})
		/* db.table_drop('testB') */

		suite.T().Log("About to run line #361: db.TableDrop('testB')")

		runAndAssert(suite.Suite, expected_, db.TableDrop("testB"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #361")
	}

	{
		// meta/table.yaml line #364
		/* partial({'dbs_dropped':1,'tables_dropped':1}) */
		var expected_ compare.Expected = compare.PartialMatch(map[interface{}]interface{}{"dbs_dropped": 1, "tables_dropped": 1})
		/* r.db_drop('test2') */

		suite.T().Log("About to run line #364: r.DBDrop('test2')")

		runAndAssert(suite.Suite, expected_, r.DBDrop("test2"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #364")
	}
}
Exemplo n.º 26
0
func (suite *DatumObjectSuite) TestCases() {
	suite.T().Log("Running DatumObjectSuite: Tests conversion to and from the RQL object type")

	{
		// datum/object.yaml line #6
		/* {} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{}
		/* r.expr({}) */

		suite.T().Log("About to run line #6: r.Expr(map[interface{}]interface{}{})")

		runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #6")
	}

	{
		// datum/object.yaml line #11
		/* {'a':1} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1}
		/* r.expr({'a':1}) */

		suite.T().Log("About to run line #11: r.Expr(map[interface{}]interface{}{'a': 1, })")

		runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": 1}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #11")
	}

	{
		// datum/object.yaml line #16
		/* {'a':1, 'b':'two', 'c':True} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": "two", "c": true}
		/* r.expr({'a':1, 'b':'two', 'c':True}) */

		suite.T().Log("About to run line #16: r.Expr(map[interface{}]interface{}{'a': 1, 'b': 'two', 'c': true, })")

		runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": 1, "b": "two", "c": true}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #16")
	}

	{
		// datum/object.yaml line #20
		/* {'a':1} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1}
		/* r.expr({'a':r.expr(1)}) */

		suite.T().Log("About to run line #20: r.Expr(map[interface{}]interface{}{'a': r.Expr(1), })")

		runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": r.Expr(1)}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #20")
	}

	{
		// datum/object.yaml line #23
		/* {'a':{'b':[{'c':2}, 'a', 4]}} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": []interface{}{map[interface{}]interface{}{"c": 2}, "a", 4}}}
		/* r.expr({'a':{'b':[{'c':2}, 'a', 4]}}) */

		suite.T().Log("About to run line #23: r.Expr(map[interface{}]interface{}{'a': map[interface{}]interface{}{'b': []interface{}{map[interface{}]interface{}{'c': 2, }, 'a', 4}, }, })")

		runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": []interface{}{map[interface{}]interface{}{"c": 2}, "a", 4}}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #23")
	}

	{
		// datum/object.yaml line #26
		/* 'OBJECT' */
		var expected_ string = "OBJECT"
		/* r.expr({'a':1}).type_of() */

		suite.T().Log("About to run line #26: r.Expr(map[interface{}]interface{}{'a': 1, }).TypeOf()")

		runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": 1}).TypeOf(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #26")
	}

	{
		// datum/object.yaml line #30
		/* '{"a":1}' */
		var expected_ string = "{\"a\":1}"
		/* r.expr({'a':1}).coerce_to('string') */

		suite.T().Log("About to run line #30: r.Expr(map[interface{}]interface{}{'a': 1, }).CoerceTo('string')")

		runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": 1}).CoerceTo("string"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #30")
	}

	{
		// datum/object.yaml line #34
		/* {'a':1} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1}
		/* r.expr({'a':1}).coerce_to('object') */

		suite.T().Log("About to run line #34: r.Expr(map[interface{}]interface{}{'a': 1, }).CoerceTo('object')")

		runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": 1}).CoerceTo("object"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #34")
	}

	{
		// datum/object.yaml line #37
		/* [['a',1]] */
		var expected_ []interface{} = []interface{}{[]interface{}{"a", 1}}
		/* r.expr({'a':1}).coerce_to('array') */

		suite.T().Log("About to run line #37: r.Expr(map[interface{}]interface{}{'a': 1, }).CoerceTo('array')")

		runAndAssert(suite.Suite, expected_, r.Expr(map[interface{}]interface{}{"a": 1}).CoerceTo("array"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #37")
	}

	{
		// datum/object.yaml line #66
		/* {} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{}
		/* r.object() */

		suite.T().Log("About to run line #66: r.Object()")

		runAndAssert(suite.Suite, expected_, r.Object(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #66")
	}

	{
		// datum/object.yaml line #69
		/* {'a':1,'b':2} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"a": 1, "b": 2}
		/* r.object('a', 1, 'b', 2) */

		suite.T().Log("About to run line #69: r.Object('a', 1, 'b', 2)")

		runAndAssert(suite.Suite, expected_, r.Object("a", 1, "b", 2), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #69")
	}

	{
		// datum/object.yaml line #72
		/* {'cd':3} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"cd": 3}
		/* r.object('c'+'d', 3) */

		suite.T().Log("About to run line #72: r.Object(r.Add('c', 'd'), 3)")

		runAndAssert(suite.Suite, expected_, r.Object(r.Add("c", "d"), 3), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #72")
	}

	{
		// datum/object.yaml line #75
		/* err("ReqlQueryLogicError", "OBJECT expects an even number of arguments (but found 3).", []) */
		var expected_ Err = err("ReqlQueryLogicError", "OBJECT expects an even number of arguments (but found 3).")
		/* r.object('o','d','d') */

		suite.T().Log("About to run line #75: r.Object('o', 'd', 'd')")

		runAndAssert(suite.Suite, expected_, r.Object("o", "d", "d"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #75")
	}

	{
		// datum/object.yaml line #78
		/* err("ReqlQueryLogicError","Expected type STRING but found NUMBER.",[]) */
		var expected_ Err = err("ReqlQueryLogicError", "Expected type STRING but found NUMBER.")
		/* r.object(1, 1) */

		suite.T().Log("About to run line #78: r.Object(1, 1)")

		runAndAssert(suite.Suite, expected_, r.Object(1, 1), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #78")
	}

	{
		// datum/object.yaml line #81
		/* err("ReqlQueryLogicError","Duplicate key \"e\" in object.  (got 4 and 5 as values)",[]) */
		var expected_ Err = err("ReqlQueryLogicError", "Duplicate key \"e\" in object.  (got 4 and 5 as values)")
		/* r.object('e', 4, 'e', 5) */

		suite.T().Log("About to run line #81: r.Object('e', 4, 'e', 5)")

		runAndAssert(suite.Suite, expected_, r.Object("e", 4, "e", 5), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #81")
	}

	{
		// datum/object.yaml line #84
		/* err("ReqlQueryLogicError","Expected type DATUM but found DATABASE:",[]) */
		var expected_ Err = err("ReqlQueryLogicError", "Expected type DATUM but found DATABASE:")
		/* r.object('g', r.db('test')) */

		suite.T().Log("About to run line #84: r.Object('g', r.DB('test'))")

		runAndAssert(suite.Suite, expected_, r.Object("g", r.DB("test")), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #84")
	}
}
Exemplo n.º 27
0
func (suite *TransformFoldSuite) TestCases() {
	suite.T().Log("Running TransformFoldSuite: Tests for the fold term")

	tbl := r.DB("test").Table("tbl")
	_ = tbl // Prevent any noused variable errors

	{
		// transform/fold.yaml line #6
		/* {'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':100} */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 100}
		/* tbl.insert(r.range(100).map(lambda i: {'id':i, 'a':i%4}).coerce_to("array")) */

		suite.T().Log("About to run line #6: tbl.Insert(r.Range(100).Map(func(i r.Term) interface{} { return map[interface{}]interface{}{'id': i, 'a': r.Mod(i, 4), }}).CoerceTo('array'))")

		runAndAssert(suite.Suite, expected_, tbl.Insert(r.Range(100).Map(func(i r.Term) interface{} { return map[interface{}]interface{}{"id": i, "a": r.Mod(i, 4)} }).CoerceTo("array")), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #6")
	}

	{
		// transform/fold.yaml line #19
		/* 10 */
		var expected_ int = 10
		/* r.range(0, 10).fold(0, lambda acc, row: acc.add(1)) */

		suite.T().Log("About to run line #19: r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)})")

		runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #19")
	}

	{
		// transform/fold.yaml line #23
		/* 20 */
		var expected_ int = 20
		/* r.range(0, 10).fold(0, lambda acc, row: acc.add(1), final_emit=lambda acc: acc.mul(2)) */

		suite.T().Log("About to run line #23: r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{FinalEmit: func(acc r.Term) interface{} { return acc.Mul(2)}, })")

		runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{FinalEmit: func(acc r.Term) interface{} { return acc.Mul(2) }}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #23")
	}

	{
		// transform/fold.yaml line #27
		/* [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] */
		var expected_ []interface{} = []interface{}{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
		/* r.range(0, 10).fold(0, lambda acc, row: acc.add(1), emit=lambda old,row,acc: [row]).coerce_to("array") */

		suite.T().Log("About to run line #27: r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{row}}, }).CoerceTo('array')")

		runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{row} }}).CoerceTo("array"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #27")
	}

	{
		// transform/fold.yaml line #31
		/* [2, 5, 8, 10] */
		var expected_ []interface{} = []interface{}{2, 5, 8, 10}
		/* r.range(0, 10).fold(0, lambda acc, row: acc.add(1), emit=lambda old,row,acc: r.branch(acc.mod(3).eq(0),[row],[]),final_emit=lambda acc: [acc]).coerce_to("array") */

		suite.T().Log("About to run line #31: r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return r.Branch(acc.Mod(3).Eq(0), []interface{}{row}, []interface{}{})}, FinalEmit: func(acc r.Term) interface{} { return []interface{}{acc}}, }).CoerceTo('array')")

		runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} {
			return r.Branch(acc.Mod(3).Eq(0), []interface{}{row}, []interface{}{})
		}, FinalEmit: func(acc r.Term) interface{} { return []interface{}{acc} }}).CoerceTo("array"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #31")
	}

	{
		// transform/fold.yaml line #35
		/* [1, 2, 3, 5, 8, 13, 21, 34, 55, 89] */
		var expected_ []interface{} = []interface{}{1, 2, 3, 5, 8, 13, 21, 34, 55, 89}
		/* r.range(0, 10).fold([1, 1], lambda acc, row: [acc[1], acc[0].add(acc[1])], emit=lambda old,row,acc: [acc[0]]).coerce_to("array") */

		suite.T().Log("About to run line #35: r.Range(0, 10).Fold([]interface{}{1, 1}, func(acc r.Term, row r.Term) interface{} { return []interface{}{acc.AtIndex(1), acc.AtIndex(0).Add(acc.AtIndex(1))}}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc.AtIndex(0)}}, }).CoerceTo('array')")

		runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold([]interface{}{1, 1}, func(acc r.Term, row r.Term) interface{} {
			return []interface{}{acc.AtIndex(1), acc.AtIndex(0).Add(acc.AtIndex(1))}
		}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc.AtIndex(0)} }}).CoerceTo("array"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #35")
	}

	{
		// transform/fold.yaml line #37
		/* "STREAM" */
		var expected_ string = "STREAM"
		/* r.range(0, 10).fold(0, lambda acc, row: acc, emit=lambda old,row,acc: acc).type_of() */

		suite.T().Log("About to run line #37: r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return acc}, }).TypeOf()")

		runAndAssert(suite.Suite, expected_, r.Range(0, 10).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return acc }}).TypeOf(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #37")
	}

	{
		// transform/fold.yaml line #39
		/* [{'a': 0, 'id': 20}, {'a': 3, 'id': 15}, {'a': 2, 'id': 46}, {'a': 2, 'id': 78}, {'a': 2, 'id': 90}] */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"a": 0, "id": 20}, map[interface{}]interface{}{"a": 3, "id": 15}, map[interface{}]interface{}{"a": 2, "id": 46}, map[interface{}]interface{}{"a": 2, "id": 78}, map[interface{}]interface{}{"a": 2, "id": 90}}
		/* tbl.filter("id").fold(0, lambda acc, row: acc.add(1), emit=lambda old,row,acc: r.branch(old.mod(20).eq(0),[row],[])).coerce_to("array") */

		suite.T().Log("About to run line #39: tbl.Filter('id').Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return r.Branch(old.Mod(20).Eq(0), []interface{}{row}, []interface{}{})}, }).CoerceTo('array')")

		runAndAssert(suite.Suite, expected_, tbl.Filter("id").Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} {
			return r.Branch(old.Mod(20).Eq(0), []interface{}{row}, []interface{}{})
		}}).CoerceTo("array"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #39")
	}

	{
		// transform/fold.yaml line #42
		/* [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] */
		var expected_ []interface{} = []interface{}{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
		/* r.range().fold(0, lambda acc, row: acc.add(1), emit=lambda old,row,acc: [acc]).limit(10) */

		suite.T().Log("About to run line #42: r.Range().Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc}}, }).Limit(10)")

		runAndAssert(suite.Suite, expected_, r.Range().Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc} }}).Limit(10), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #42")
	}

	{
		// transform/fold.yaml line #45
		/* err("ReqlQueryLogicError", "Cannot use an infinite stream with an aggregation function (`reduce`, `count`, etc.) or coerce it to an array.") */
		var expected_ Err = err("ReqlQueryLogicError", "Cannot use an infinite stream with an aggregation function (`reduce`, `count`, etc.) or coerce it to an array.")
		/* r.range().fold(0, lambda acc, row: acc.add(1), emit=lambda old,row,acc: [acc]).map(lambda doc: 1).reduce(lambda l, r: l+r) */

		suite.T().Log("About to run line #45: r.Range().Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc}}, }).Map(func(doc r.Term) interface{} { return 1}).Reduce(func(l r.Term, r r.Term) interface{} { return r.Add(l, r)})")

		runAndAssert(suite.Suite, expected_, r.Range().Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc} }}).Map(func(doc r.Term) interface{} { return 1 }).Reduce(func(l r.Term, r r.Term) interface{} { return r.Add(l, r) }), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #45")
	}

	{
		// transform/fold.yaml line #48
		/* [x for x in range(1, 1001)] */
		var expected_ []interface{} = (func() []interface{} {
			res := []interface{}{}
			for iterator_ := 1; iterator_ < 1001; iterator_++ {
				x := iterator_
				res = append(res, x)
			}
			return res
		}())
		/* r.range(0, 1000).fold(0, lambda acc, row: acc.add(1), emit=lambda old,row,acc: [acc]).coerce_to("array") */

		suite.T().Log("About to run line #48: r.Range(0, 1000).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1)}).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc}}, }).CoerceTo('array')")

		runAndAssert(suite.Suite, expected_, r.Range(0, 1000).Fold(0, func(acc r.Term, row r.Term) interface{} { return acc.Add(1) }).OptArgs(r.FoldOpts{Emit: func(old r.Term, row r.Term, acc r.Term) interface{} { return []interface{}{acc} }}).CoerceTo("array"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #48")
	}
}
Exemplo n.º 28
0
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")
	}
}
Exemplo n.º 29
0
func (suite *MatchSuite) TestCases() {
	suite.T().Log("Running MatchSuite: Tests for match")

	tbl := r.DB("test").Table("tbl")
	_ = tbl // Prevent any noused variable errors

	{
		// match.yaml line #4
		/* ({'str':'bcde','groups':[null,{'start':2,'str':'cde','end':5}],'start':1,'end':5}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"str": "bcde", "groups": []interface{}{nil, map[interface{}]interface{}{"start": 2, "str": "cde", "end": 5}}, "start": 1, "end": 5}
		/* r.expr("abcdefg").match("a(b.e)|b(c.e)") */

		suite.T().Log("About to run line #4: r.Expr('abcdefg').Match('a(b.e)|b(c.e)')")

		runAndAssert(suite.Suite, expected_, r.Expr("abcdefg").Match("a(b.e)|b(c.e)"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #4")
	}

	{
		// match.yaml line #6
		/* (null) */
		var expected_ interface{} = nil
		/* r.expr("abcdefg").match("a(b.e)|B(c.e)") */

		suite.T().Log("About to run line #6: r.Expr('abcdefg').Match('a(b.e)|B(c.e)')")

		runAndAssert(suite.Suite, expected_, r.Expr("abcdefg").Match("a(b.e)|B(c.e)"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #6")
	}

	{
		// match.yaml line #8
		/* ({'str':'bcde','groups':[null,{'start':2,'str':'cde','end':5}],'start':1,'end':5}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"str": "bcde", "groups": []interface{}{nil, map[interface{}]interface{}{"start": 2, "str": "cde", "end": 5}}, "start": 1, "end": 5}
		/* r.expr("abcdefg").match("(?i)a(b.e)|B(c.e)") */

		suite.T().Log("About to run line #8: r.Expr('abcdefg').Match('(?i)a(b.e)|B(c.e)')")

		runAndAssert(suite.Suite, expected_, r.Expr("abcdefg").Match("(?i)a(b.e)|B(c.e)"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #8")
	}

	{
		// match.yaml line #12
		/* (["aca", "ada"]) */
		var expected_ []interface{} = []interface{}{"aca", "ada"}
		/* r.expr(["aba", "aca", "ada", "aea"]).filter(lambda row:row.match("a(.)a")['groups'][0]['str'].match("[cd]")) */

		suite.T().Log("About to run line #12: r.Expr([]interface{}{'aba', 'aca', 'ada', 'aea'}).Filter(func(row r.Term) interface{} { return row.Match('a(.)a').AtIndex('groups').AtIndex(0).AtIndex('str').Match('[cd]')})")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{"aba", "aca", "ada", "aea"}).Filter(func(row r.Term) interface{} {
			return row.Match("a(.)a").AtIndex("groups").AtIndex(0).AtIndex("str").Match("[cd]")
		}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #12")
	}

	{
		// match.yaml line #16
		/* ({'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':3}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 3}
		/* tbl.insert([{'id':0,'a':'abc'},{'id':1,'a':'ab'},{'id':2,'a':'bc'}]) */

		suite.T().Log("About to run line #16: tbl.Insert([]interface{}{map[interface{}]interface{}{'id': 0, 'a': 'abc', }, map[interface{}]interface{}{'id': 1, 'a': 'ab', }, map[interface{}]interface{}{'id': 2, 'a': 'bc', }})")

		runAndAssert(suite.Suite, expected_, tbl.Insert([]interface{}{map[interface{}]interface{}{"id": 0, "a": "abc"}, map[interface{}]interface{}{"id": 1, "a": "ab"}, map[interface{}]interface{}{"id": 2, "a": "bc"}}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #16")
	}

	{
		// match.yaml line #20
		/* ([{'id':0,'a':'abc'},{'id':1,'a':'ab'},{'id':2,'a':'bc'}]) */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 0, "a": "abc"}, map[interface{}]interface{}{"id": 1, "a": "ab"}, map[interface{}]interface{}{"id": 2, "a": "bc"}}
		/* tbl.filter(lambda row:row['a'].match('b')).order_by('id') */

		suite.T().Log("About to run line #20: tbl.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Match('b')}).OrderBy('id')")

		runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Match("b") }).OrderBy("id"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #20")
	}

	{
		// match.yaml line #24
		/* ([{'id':0,'a':'abc'},{'id':1,'a':'ab'}]) */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 0, "a": "abc"}, map[interface{}]interface{}{"id": 1, "a": "ab"}}
		/* tbl.filter(lambda row:row['a'].match('ab')).order_by('id') */

		suite.T().Log("About to run line #24: tbl.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Match('ab')}).OrderBy('id')")

		runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Match("ab") }).OrderBy("id"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #24")
	}

	{
		// match.yaml line #28
		/* ([{'id':1,'a':'ab'}]) */
		var expected_ []interface{} = []interface{}{map[interface{}]interface{}{"id": 1, "a": "ab"}}
		/* tbl.filter(lambda row:row['a'].match('ab$')).order_by('id') */

		suite.T().Log("About to run line #28: tbl.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Match('ab$')}).OrderBy('id')")

		runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Match("ab$") }).OrderBy("id"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #28")
	}

	{
		// match.yaml line #32
		/* ([]) */
		var expected_ []interface{} = []interface{}{}
		/* tbl.filter(lambda row:row['a'].match('^b$')).order_by('id') */

		suite.T().Log("About to run line #32: tbl.Filter(func(row r.Term) interface{} { return row.AtIndex('a').Match('^b$')}).OrderBy('id')")

		runAndAssert(suite.Suite, expected_, tbl.Filter(func(row r.Term) interface{} { return row.AtIndex("a").Match("^b$") }).OrderBy("id"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #32")
	}

	{
		// match.yaml line #36
		/* err("ReqlQueryLogicError", "Error in regexp `ab\\9` (portion `\\9`): invalid escape sequence: \\9", []) */
		var expected_ Err = err("ReqlQueryLogicError", "Error in regexp `ab\\9` (portion `\\9`): invalid escape sequence: \\9")
		/* r.expr("").match("ab\\9") */

		suite.T().Log("About to run line #36: r.Expr('').Match('ab\\\\9')")

		runAndAssert(suite.Suite, expected_, r.Expr("").Match("ab\\9"), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #36")
	}
}
Exemplo n.º 30
0
func (suite *MutationDeleteSuite) TestCases() {
	suite.T().Log("Running MutationDeleteSuite: Tests deletes of selections")

	tbl := r.DB("test").Table("tbl")
	_ = tbl // Prevent any noused variable errors

	{
		// mutation/delete.yaml line #7
		/* ({'deleted':0,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':100}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 0, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 100}
		/* tbl.insert([{'id':i} for i in xrange(100)]) */

		suite.T().Log("About to run line #7: 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 #7")
	}

	{
		// mutation/delete.yaml line #19
		/* 100 */
		var expected_ int = 100
		/* tbl.count() */

		suite.T().Log("About to run line #19: tbl.Count()")

		runAndAssert(suite.Suite, expected_, tbl.Count(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #19")
	}

	{
		// mutation/delete.yaml line #24
		/* ({'deleted':1,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':0}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 1, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 0}
		/* tbl.get(12).delete() */

		suite.T().Log("About to run line #24: tbl.Get(12).Delete()")

		runAndAssert(suite.Suite, expected_, tbl.Get(12).Delete(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #24")
	}

	{
		// mutation/delete.yaml line #31
		/* 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.skip(50).delete(durability='wrong') */

		suite.T().Log("About to run line #31: tbl.Skip(50).Delete().OptArgs(r.DeleteOpts{Durability: 'wrong', })")

		runAndAssert(suite.Suite, expected_, tbl.Skip(50).Delete().OptArgs(r.DeleteOpts{Durability: "wrong"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #31")
	}

	{
		// mutation/delete.yaml line #38
		/* ({'deleted':49,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':0}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 49, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 0}
		/* tbl.skip(50).delete(durability='soft') */

		suite.T().Log("About to run line #38: tbl.Skip(50).Delete().OptArgs(r.DeleteOpts{Durability: 'soft', })")

		runAndAssert(suite.Suite, expected_, tbl.Skip(50).Delete().OptArgs(r.DeleteOpts{Durability: "soft"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #38")
	}

	{
		// mutation/delete.yaml line #45
		/* ({'deleted':50,'replaced':0,'unchanged':0,'errors':0,'skipped':0,'inserted':0}) */
		var expected_ map[interface{}]interface{} = map[interface{}]interface{}{"deleted": 50, "replaced": 0, "unchanged": 0, "errors": 0, "skipped": 0, "inserted": 0}
		/* tbl.delete(durability='hard') */

		suite.T().Log("About to run line #45: tbl.Delete().OptArgs(r.DeleteOpts{Durability: 'hard', })")

		runAndAssert(suite.Suite, expected_, tbl.Delete().OptArgs(r.DeleteOpts{Durability: "hard"}), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #45")
	}

	{
		// mutation/delete.yaml line #49
		/* err('ReqlQueryLogicError', 'Expected type SELECTION but found DATUM:', [0]) */
		var expected_ Err = err("ReqlQueryLogicError", "Expected type SELECTION but found DATUM:")
		/* r.expr([1, 2]).delete() */

		suite.T().Log("About to run line #49: r.Expr([]interface{}{1, 2}).Delete()")

		runAndAssert(suite.Suite, expected_, r.Expr([]interface{}{1, 2}).Delete(), suite.session, r.RunOpts{
			GeometryFormat: "raw",
			GroupFormat:    "map",
		})
		suite.T().Log("Finished running line #49")
	}
}