How to use does_not_contain method in Sure

Best Python code snippet using sure_python

test_local_namespace.py

Source: test_local_namespace.py Github

copy

Full Screen

1import unittest2import datafilereader3from nose.tools import assert_equals, assert_false, assert_true4class TestLocalNamespace(unittest.TestCase):5 def setUp(self):6 self._project = datafilereader.construct_project(datafilereader.SIMPLE_PROJECT)7 self._test = datafilereader.get_ctrl_by_name('Test Case', self._project.datafiles[0].tests)8 self._keyword = datafilereader.get_ctrl_by_name('Keyword', self._project.datafiles[0].keywords)9 print self._keyword10 def tearDown(self):11 self._project.close()12 def test_macro_controller_has_local_namespace(self):13 assert_true(self._test.get_local_namespace() is not None)14 assert_true(self._keyword.get_local_namespace() is not None)15 def test_keyword_argument_is_visible_in_keywords_local_namespace(self):16 assert_true(self._keyword.get_local_namespace().has_name('${argument}'))17 def test_keyword_argument_is_not_visible_in_test_cases_local_namespace(self):18 assert_false(self._test.get_local_namespace().has_name('${argument}'))19 def test_keyword_steps_local_namespace_does_not_contain_local_variables_before_definition(self):20 for i in range(8):21 local_namespace = self._keyword.get_local_namespace_for_row(i)22 if i < 3:23 assert_false(local_namespace.has_name('${foo}'))24 if i < 5:25 assert_false(local_namespace.has_name('${bar}'))26 if i < 7:27 assert_false(local_namespace.has_name('${i}'))28 def test_keyword_steps_local_namespace_does_contain_local_variables_after_definition(self):29 for i in range(8):30 local_namespace = self._keyword.get_local_namespace_for_row(i)31 assert_true(local_namespace.has_name('${argument}'))32 if i >= 3:33 assert_true(local_namespace.has_name('${foo}'))34 if i >= 5:35 assert_true(local_namespace.has_name('${bar}'))36 if i >= 7:37 assert_true(local_namespace.has_name('${i}'))38 def test_keyword_steps_suggestions_with_local_variables(self):39 self._verify_suggestions_on_row(0, contains=['${argument}'], does_not_contain=['${foo}', '${bar}', '${i}'])40 self._verify_suggestions_on_row(3, contains=['${argument}', '${foo}'], does_not_contain=['${bar}', '${i}'])41 self._verify_suggestions_on_row(5, contains=['${argument}', '${foo}', '${bar}'], does_not_contain=['${i}'])42 self._verify_suggestions_on_row(7, contains=['${argument}', '${foo}', '${bar}', '${i}'])43 def test_suggestions_when_empty_text(self):44 self._verify_suggestions_on_row(4, start='', contains=['${argument}', '${foo}'], does_not_contain=['${bar}'])45 def test_suggestions_when_no_match(self):46 self._verify_suggestions_on_row(5, start='${no match}', does_not_contain=['${argument}', '${foo}', '${bar}'])47 def test_suggestions_when_only_part_matches(self):48 self._verify_suggestions_on_row(4, start='${f', contains=['${foo}'], does_not_contain=['${argument}', '${bar}'])49 self._verify_suggestions_on_row(4, start='fo', contains=['${foo}'], does_not_contain=['${argument}', '${bar}'])50 def _verify_suggestions_on_row(self, row, start='${', contains=None, does_not_contain=None):51 suggestion_names = [suggestion.name for suggestion in self._keyword.get_local_namespace_for_row(row).get_suggestions(start)]52 self.assertEquals(len(suggestion_names), len(set(suggestion_names)))53 if contains:54 for name in contains:55 if name not in suggestion_names:56 raise AssertionError('Suggestions on row (%s) did not contain expected value "%s"' % (str(row), name))57 if does_not_contain:58 for name in does_not_contain:59 if name in suggestion_names:60 raise AssertionError('Suggestions on row (%s) did contain illegal value "%s"' % (str(row), name))61if __name__ == '__main__':...

Full Screen

Full Screen

test_comment_sidecar_js_delivery.py

Source: test_comment_sidecar_js_delivery.py Github

copy

Full Screen

...7 response = requests.get(COMMENT_SIDECAR_URL)8 assert_that(response.status_code).is_equal_to(200)9 js = response.text10 assert_that(js).contains("<form>")11 assert_that(js).does_not_contain("{{comments}}")12 assert_that(js).contains("Comments")13 assert_that(js).does_not_contain("{{name}}")14 assert_that(js).contains("Name")15 assert_that(js).does_not_contain("{{emailHint}}")16 assert_that(js).contains("The E-Mail is optional.")17 assert_that(js).does_not_contain("{{submit}}")18 assert_that(js).contains("Submit")19 assert_that(js).does_not_contain("{{noCommentsYet}}")20 assert_that(js).contains("No comments yet. Be the first!")21 assert_that(js).does_not_contain("{{successMessage}}")22 assert_that(js).contains("Successfully submitted comment.")23 assert_that(js).does_not_contain("{{failMessage}}")24 assert_that(js).contains("Couldn't submit your comment. Reason: ")25 assert_that(js).does_not_contain("{{SITE}}")26 assert_that(js).contains("localhost")27 assert_that(js).does_not_contain("{{BASE_PATH}}")28 assert_that(js).contains("/​comment-sidecar.php")29def test_use_gzip():30 response = requests.get(COMMENT_SIDECAR_URL)31 assert_that(response.headers['Content-Encoding']).is_equal_to("gzip")32if __name__ == '__main__':...

Full Screen

Full Screen

Blogs

Check out the latest blogs from LambdaTest on this topic:

How Evolution Of HTTP/2 From HTTP/1 Changed The Web

Ever came across the situation where you really need to open a web page fast and it’s taking forever because of slow internet speed? May be someone in your network is downloading a torrent choking the bandwidth?

A Guide For Testing Fintech Applications(With Examples)

In today’s scenario, software testing has become an important entity across every domain for the benefits it offers. We have already explored a lot about software testing in general in our post need of software testing.

How to Test a Mobile Website Using LambdaTest

This article is a part of our Content Hub. For more in-depth resources, check out our content hub on Mobile Testing Tutorial.

Agile Vs Waterfall Methodology

Before development of a project begins, the project manager’s job is to determine which methodology should be used for the project life cycle. The 2 most popular methodologies are

Common Bugs in User Interface Design

In human physiology, vision plays a major role as 83% of the information humans perceive is via sight. So, your website should never lack in visual appeal. In web design, this is even more important. Every new iteration of design leaves some minor deviations. Sometimes, these minor visual deviations can be very hard to fix or unknowingly break the whole user experience. Hence, it is necessary to make sure that your website provides a perfect and working interface design to the user.

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