How to use assert_is_not method in Testify

Best Python code snippet using Testify_python

test_coreviews.py

Source:test_coreviews.py Github

copy

Full Screen

...24 def test_copy(self):25 avcopy = self.av.copy()26 assert_equal(avcopy[0], self.av[0])27 assert_equal(avcopy, self.av)28 assert_is_not(avcopy[0], self.av[0])29 assert_is_not(avcopy, self.av)30 avcopy[5] = {}31 assert_not_equal(avcopy, self.av)32 avcopy[0]['ht'] = 433 assert_not_equal(avcopy[0], self.av[0])34 self.av[0]['ht'] = 435 assert_equal(avcopy[0], self.av[0])36 del self.av[0]['ht']37 assert_false(hasattr(self.av, '__setitem__'))38 def test_items(self):39 assert_equal(sorted(self.av.items()), sorted(self.d.items()))40 def test_str(self):41 out = str(self.d)42 assert_equal(str(self.av), out)43 def test_repr(self):44 out = "AtlasView(" + str(self.d) + ")"45 assert_equal(repr(self.av), out)46class TestAdjacencyView(object):47 # node->nbr->data48 def setup(self):49 dd = {'color': 'blue', 'weight': 1.2}50 self.nd = {0: dd, 1: {}, 2: {'color': 1}}51 self.adj = {3: self.nd, 0: {3: dd}, 1: {}, 2: {3: {'color': 1}}}52 self.adjview = nx.classes.coreviews.AdjacencyView(self.adj)53 def test_pickle(self):54 view = self.adjview55 pview = pickle.loads(pickle.dumps(view, -1))56 assert_equal(view, pview)57 assert_equal(view.__slots__, pview.__slots__)58 def test_len(self):59 assert_equal(len(self.adjview), len(self.adj))60 def test_iter(self):61 assert_equal(list(self.adjview), list(self.adj))62 def test_getitem(self):63 assert_is_not(self.adjview[1], self.adj[1])64 assert_is(self.adjview[3][0], self.adjview[0][3])65 assert_equal(self.adjview[2][3]['color'], 1)66 assert_raises(KeyError, self.adjview.__getitem__, 4)67 def test_copy(self):68 avcopy = self.adjview.copy()69 assert_equal(avcopy[0], self.adjview[0])70 assert_is_not(avcopy[0], self.adjview[0])71 avcopy[2][3]['ht'] = 472 assert_not_equal(avcopy[2], self.adjview[2])73 self.adjview[2][3]['ht'] = 474 assert_equal(avcopy[2], self.adjview[2])75 del self.adjview[2][3]['ht']76 assert_false(hasattr(self.adjview, '__setitem__'))77 def test_items(self):78 view_items = sorted((n, dict(d)) for n, d in self.adjview.items())79 assert_equal(view_items, sorted(self.adj.items()))80 def test_str(self):81 out = str(dict(self.adj))82 assert_equal(str(self.adjview), out)83 def test_repr(self):84 out = self.adjview.__class__.__name__ + "(" + str(self.adj) + ")"85 assert_equal(repr(self.adjview), out)86class TestMultiAdjacencyView(TestAdjacencyView):87 # node->nbr->key->data88 def setup(self):89 dd = {'color': 'blue', 'weight': 1.2}90 self.kd = {0: dd, 1: {}, 2: {'color': 1}}91 self.nd = {3: self.kd, 0: {3: dd}, 1: {0: {}}, 2: {3: {'color': 1}}}92 self.adj = {3: self.nd, 0: {3: {3: dd}}, 1: {}, 2: {3: {8: {}}}}93 self.adjview = nx.classes.coreviews.MultiAdjacencyView(self.adj)94 def test_getitem(self):95 assert_is_not(self.adjview[1], self.adj[1])96 assert_is(self.adjview[3][0][3], self.adjview[0][3][3])97 assert_equal(self.adjview[3][2][3]['color'], 1)98 assert_raises(KeyError, self.adjview.__getitem__, 4)99 def test_copy(self):100 avcopy = self.adjview.copy()101 assert_equal(avcopy[0], self.adjview[0])102 assert_is_not(avcopy[0], self.adjview[0])103 avcopy[2][3][8]['ht'] = 4104 assert_not_equal(avcopy[2], self.adjview[2])105 self.adjview[2][3][8]['ht'] = 4106 assert_equal(avcopy[2], self.adjview[2])107 del self.adjview[2][3][8]['ht']108 assert_false(hasattr(self.adjview, '__setitem__'))109class TestUnionAtlas(object):110 # node->data111 def setup(self):112 self.s = {0: {'color': 'blue', 'weight': 1.2}, 1: {}, 2: {'color': 1}}113 self.p = {3: {'color': 'blue', 'weight': 1.2}, 4: {}, 2: {'watch': 2}}114 self.av = nx.classes.coreviews.UnionAtlas(self.s, self.p)115 def test_pickle(self):116 view = self.av117 pview = pickle.loads(pickle.dumps(view, -1))118 assert_equal(view, pview)119 assert_equal(view.__slots__, pview.__slots__)120 def test_len(self):121 assert_equal(len(self.av), len(self.s) + len(self.p))122 def test_iter(self):123 assert_equal(set(self.av), set(self.s) | set(self.p))124 def test_getitem(self):125 assert_is(self.av[0], self.s[0])126 assert_is(self.av[4], self.p[4])127 assert_equal(self.av[2]['color'], 1)128 assert_raises(KeyError, self.av[2].__getitem__, 'watch')129 assert_raises(KeyError, self.av.__getitem__, 8)130 def test_copy(self):131 avcopy = self.av.copy()132 assert_equal(avcopy[0], self.av[0])133 assert_is_not(avcopy[0], self.av[0])134 assert_is_not(avcopy, self.av)135 avcopy[5] = {}136 assert_not_equal(avcopy, self.av)137 avcopy[0]['ht'] = 4138 assert_not_equal(avcopy[0], self.av[0])139 self.av[0]['ht'] = 4140 assert_equal(avcopy[0], self.av[0])141 del self.av[0]['ht']142 assert_false(hasattr(self.av, '__setitem__'))143 def test_items(self):144 expected = dict(self.p.items())145 expected.update(self.s)146 assert_equal(sorted(self.av.items()), sorted(expected.items()))147 def test_str(self):148 out = str(dict(self.av))149 assert_equal(str(self.av), out)150 def test_repr(self):151 out = "{}({}, {})".format(self.av.__class__.__name__, self.s, self.p)152 assert_equal(repr(self.av), out)153class TestUnionAdjacency(object):154 # node->nbr->data155 def setup(self):156 dd = {'color': 'blue', 'weight': 1.2}157 self.nd = {0: dd, 1: {}, 2: {'color': 1}}158 self.s = {3: self.nd, 0: {}, 1: {}, 2: {3: {'color': 1}}}159 self.p = {3: {}, 0: {3: dd}, 1: {0: {}}, 2: {1: {'color': 1}}}160 self.adjview = nx.classes.coreviews.UnionAdjacency(self.s, self.p)161 def test_pickle(self):162 view = self.adjview163 pview = pickle.loads(pickle.dumps(view, -1))164 assert_equal(view, pview)165 assert_equal(view.__slots__, pview.__slots__)166 def test_len(self):167 assert_equal(len(self.adjview), len(self.s))168 def test_iter(self):169 assert_equal(sorted(self.adjview), sorted(self.s))170 def test_getitem(self):171 assert_is_not(self.adjview[1], self.s[1])172 assert_is(self.adjview[3][0], self.adjview[0][3])173 assert_equal(self.adjview[2][3]['color'], 1)174 assert_raises(KeyError, self.adjview.__getitem__, 4)175 def test_copy(self):176 avcopy = self.adjview.copy()177 assert_equal(avcopy[0], self.adjview[0])178 assert_is_not(avcopy[0], self.adjview[0])179 avcopy[2][3]['ht'] = 4180 assert_not_equal(avcopy[2], self.adjview[2])181 self.adjview[2][3]['ht'] = 4182 assert_equal(avcopy[2], self.adjview[2])183 del self.adjview[2][3]['ht']184 assert_false(hasattr(self.adjview, '__setitem__'))185 def test_str(self):186 out = str(dict(self.adjview))187 assert_equal(str(self.adjview), out)188 def test_repr(self):189 clsname = self.adjview.__class__.__name__190 out = "{}({}, {})".format(clsname, self.s, self.p)191 assert_equal(repr(self.adjview), out)192class TestUnionMultiInner(TestUnionAdjacency):193 # nbr->key->data194 def setup(self):195 dd = {'color': 'blue', 'weight': 1.2}196 self.kd = {7: {}, 'ekey': {}, 9: {'color': 1}}197 self.s = {3: self.kd, 0: {7: dd}, 1: {}, 2: {'key': {'color': 1}}}198 self.p = {3: {}, 0: {3: dd}, 1: {}, 2: {1: {'span': 2}}}199 self.adjview = nx.classes.coreviews.UnionMultiInner(self.s, self.p)200 def test_len(self):201 assert_equal(len(self.adjview), len(self.s) + len(self.p))202 def test_getitem(self):203 assert_is_not(self.adjview[1], self.s[1])204 assert_is(self.adjview[0][7], self.adjview[0][3])205 assert_equal(self.adjview[2]['key']['color'], 1)206 assert_equal(self.adjview[2][1]['span'], 2)207 assert_raises(KeyError, self.adjview.__getitem__, 4)208 assert_raises(KeyError, self.adjview[1].__getitem__, 'key')209 def test_copy(self):210 avcopy = self.adjview.copy()211 assert_equal(avcopy[0], self.adjview[0])212 assert_is_not(avcopy[0], self.adjview[0])213 avcopy[2][1]['width'] = 8214 assert_not_equal(avcopy[2], self.adjview[2])215 self.adjview[2][1]['width'] = 8216 assert_equal(avcopy[2], self.adjview[2])217 del self.adjview[2][1]['width']218 assert_false(hasattr(self.adjview, '__setitem__'))219 assert_true(hasattr(avcopy, '__setitem__'))220class TestUnionMultiAdjacency(TestUnionAdjacency):221 # node->nbr->key->data222 def setup(self):223 dd = {'color': 'blue', 'weight': 1.2}224 self.kd = {7: {}, 8: {}, 9: {'color': 1}}225 self.nd = {3: self.kd, 0: {9: dd}, 1: {8: {}}, 2: {9: {'color': 1}}}226 self.s = {3: self.nd, 0: {3: {7: dd}}, 1: {}, 2: {3: {8: {}}}}227 self.p = {3: {}, 0: {3: {9: dd}}, 1: {}, 2: {1: {8: {}}}}228 self.adjview = nx.classes.coreviews.UnionMultiAdjacency(self.s, self.p)229 def test_getitem(self):230 assert_is_not(self.adjview[1], self.s[1])231 assert_is(self.adjview[3][0][9], self.adjview[0][3][9])232 assert_equal(self.adjview[3][2][9]['color'], 1)233 assert_raises(KeyError, self.adjview.__getitem__, 4)234 def test_copy(self):235 avcopy = self.adjview.copy()236 assert_equal(avcopy[0], self.adjview[0])237 assert_is_not(avcopy[0], self.adjview[0])238 avcopy[2][3][8]['ht'] = 4239 assert_not_equal(avcopy[2], self.adjview[2])240 self.adjview[2][3][8]['ht'] = 4241 assert_equal(avcopy[2], self.adjview[2])242 del self.adjview[2][3][8]['ht']243 assert_false(hasattr(self.adjview, '__setitem__'))...

Full Screen

Full Screen

step_login.py

Source:step_login.py Github

copy

Full Screen

...8def open_login_window(context):9 context.login_window = context.__app.login10@when(r'I login in to the application')11def login(context):12 assert_is_not(context.login_window, None)13 QTest.keyClicks(context.login_window.login.username.input_field, "samgomena@gmail.com")14 QTest.keyClicks(context.login_window.login.pwd.input_field, "password")15 QTest.mouseClick(context.login_window.login.login_button, Qt.LeftButton)16@when(r'I enter "(.*)" in the (username|password) input box')17def enter_login_input_text(context, text, dialog_box):18 assert_is_not(context.login_window, None)19 if dialog_box == "username":20 QTest.keyClicks(context.login_window.login.username.input_field, text)21 elif dialog_box == "password":22 QTest.keyClicks(context.login_window.login.pwd.input_field, text)23@then(r'the (username|password) input box text should be "(.*)"')24def verify_login_input_text(context, dialog_box, text):25 assert_is_not(context.login_window, None)26 if dialog_box == "username":27 assert_equal(context.login_window.login.username.text(), text)28 elif dialog_box == "password":29 assert_equal(context.login_window.login.pwd.text(), text)30@when(r'I click the login button')31def click_the_button(context):32 assert_is_not(context.login_window, None)33 QTest.mouseClick(context.login_window.login.login_button, Qt.LeftButton)34@then(r'the login hint text should be "(.*)"')35def verify_login_input_text(context, text):36 assert_is_not(context.login_window, None)37 assert_equal(context.login_window.login.login_hint.text(), text)38@then(r'I should be able to log in to the application')39def verify_can_log_in(context):...

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 Testify 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