How to use test_invalid method in avocado

Best Python code snippet using avocado_python

table_config.py_one.test

Source:table_config.py_one.test Github

copy

Full Screen

...147 test_shards([148 {"replicas": ["a", "b"], "primary_replica": "a", "nonvoting_replicas": ["b"]}])149 test_shards([{"replicas": ["a"], "primary_replica": "a"}])150 utils.print_with_time("Testing that table_config rejects invalid input")151 def test_invalid(conf):152 print("Reconfiguring:", conf)153 res = r.db("rethinkdb").table("table_config").filter({"name": "foo"}).replace(conf).run(conn)154 assert res["errors"] == 1155 print("Error, as expected")156 test_invalid(r.row.merge({"shards": []}))157 test_invalid(r.row.merge({"shards": "this is a string"}))158 test_invalid(r.row.merge({"shards":159 [{"replicas": ["a"], "primary_replica": "a", "extra_key": "extra_value"}]}))160 test_invalid(r.row.merge({"shards": [{"replicas": [], "primary_replica": None}]}))161 test_invalid(r.row.merge({"shards": [{"replicas": ["a"], "primary_replica": "b"}]}))162 test_invalid(r.row.merge({"shards": [163 {"replicas": ["a"], "primary_replica": "a", "nonvoting_replicas": ["b"]}]}))164 test_invalid(r.row.merge({"shards": [165 {"replicas": ["a"], "primary_replica": "a", "nonvoting_replicas": ["a"]}]}))166 test_invalid(r.row.merge({"shards": [167 {"replicas": ["a"], "primary_replica": "a", "nonvoting_replicas": [3]}]}))168 test_invalid(r.row.merge({"shards": [169 {"replicas": ["a"], "primary_replica": "a", "nonvoting_replicas": 3}]}))170 test_invalid(r.row.merge(171 {"shards": [{"replicas": ["a"], "primary_replica": "b"},172 {"replicas": ["b"], "primary_replica": "a"}]}))173 test_invalid(r.row.merge({"primary_key": "new_primary_key"}))174 test_invalid(r.row.merge({"db": "new_db"}))175 test_invalid(r.row.merge({"extra_key": "extra_value"}))176 test_invalid(r.row.without("name"))177 test_invalid(r.row.without("primary_key"))178 test_invalid(r.row.without("db"))179 test_invalid(r.row.without("shards"))180 test_invalid(r.row.merge({"durability": "hard as rock"}))181 test_invalid(r.row.merge({"durability": 1}))182 test_invalid(r.row.merge({"write_acks": [{"replicas": ["a"], "acks": "single"}]})) # This was OK before 2.1183 test_invalid(r.row.merge({"write_acks": 3}))184 test_invalid(r.row.merge({"write_acks": "this is a string"}))185 test_invalid(r.row.without("durability"))186 test_invalid(r.row.without("write_acks"))187 utils.print_with_time("Testing that table_status is not writable")188 table_count = r.db("rethinkdb").table("table_status").count().run(conn)189 res = r.db("rethinkdb").table("table_status").delete().run(conn)190 assert res["errors"] == table_count, res191 res = r.db("rethinkdb").table("table_status").update({"foo": "bar"}).run(conn)192 assert res["errors"] == table_count, res193 res = r.db("rethinkdb").table("table_status").insert({}).run(conn)194 assert res["errors"] == 1, res195 res = r.db(dbName).table("bar").status().delete().run(conn)196 assert res["errors"] == 1, res197 utils.print_with_time("Testing that we can rename tables through table_config")198 res = r.db(dbName).table("bar").config().update({"name": "bar2"}).run(conn)199 assert res["errors"] == 0200 wait_until(lambda: check_tables_named(...

Full Screen

Full Screen

builtin_split_by_characters.py

Source:builtin_split_by_characters.py Github

copy

Full Screen

...4# (See accompanying file LICENSE_1_0.txt or copy at5# http://www.boost.org/LICENSE_1_0.txt)6# This tests the SPLIT_BY_CHARACTERS rule.7import BoostBuild8def test_invalid(params, expected_error_line):9 t = BoostBuild.Tester(pass_toolset=0)10 t.write("file.jam", "SPLIT_BY_CHARACTERS %s ;" % params)11 t.run_build_system(["-ffile.jam"], status=1)12 t.expect_output_lines("[*] %s" % expected_error_line)13 t.cleanup()14def test_valid():15 t = BoostBuild.Tester(pass_toolset=0)16 t.write("jamroot.jam", """\17import assert ;18assert.result FooBarBaz : SPLIT_BY_CHARACTERS FooBarBaz : "" ;19assert.result FooBarBaz : SPLIT_BY_CHARACTERS FooBarBaz : x ;20assert.result FooBa Baz : SPLIT_BY_CHARACTERS FooBarBaz : r ;21assert.result FooBa Baz : SPLIT_BY_CHARACTERS FooBarBaz : rr ;22assert.result FooBa Baz : SPLIT_BY_CHARACTERS FooBarBaz : rrr ;23assert.result FooB rB z : SPLIT_BY_CHARACTERS FooBarBaz : a ;24assert.result FooB B z : SPLIT_BY_CHARACTERS FooBarBaz : ar ;25assert.result ooBarBaz : SPLIT_BY_CHARACTERS FooBarBaz : F ;26assert.result FooBarBa : SPLIT_BY_CHARACTERS FooBarBaz : z ;27assert.result ooBarBa : SPLIT_BY_CHARACTERS FooBarBaz : Fz ;28assert.result F B rB z : SPLIT_BY_CHARACTERS FooBarBaz : oa ;29assert.result Alib b : SPLIT_BY_CHARACTERS Alibaba : oa ;30assert.result libaba : SPLIT_BY_CHARACTERS Alibaba : oA ;31assert.result : SPLIT_BY_CHARACTERS FooBarBaz : FooBarBaz ;32assert.result : SPLIT_BY_CHARACTERS FooBarBaz : FoBarz ;33# Questionable results - should they return an empty string or an empty list?34assert.result : SPLIT_BY_CHARACTERS "" : "" ;35assert.result : SPLIT_BY_CHARACTERS "" : x ;36assert.result : SPLIT_BY_CHARACTERS "" : r ;37assert.result : SPLIT_BY_CHARACTERS "" : rr ;38assert.result : SPLIT_BY_CHARACTERS "" : rrr ;39assert.result : SPLIT_BY_CHARACTERS "" : oa ;40""")41 t.run_build_system()42 t.cleanup()43test_invalid("", "missing argument string")44test_invalid("Foo", "missing argument delimiters")45test_invalid(": Bar", "missing argument string")46test_invalid("a : b : c", "extra argument c")47test_invalid("a b : c", "extra argument b")48test_invalid("a : b c", "extra argument c")...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run avocado automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful