Best Python code snippet using autotest_python
test_treecontroller.py
Source: test_treecontroller.py
...99 self._tsc = TestSelectionController()100 def test_test_selection_is_empty_by_default(self):101 self.assertTrue(self._tsc.is_empty())102 def test_test_selection_is_not_empty_when_it_contains_a_test(self):103 self._tsc.select(self._create_test())104 self.assertFalse(self._tsc.is_empty())105 def test_test_selection_is_empty_after_removing_same_test_from_there_even_when_it_is_not_the_same_object(self):106 self._tsc.select(self._create_test())107 self._tsc.select(self._create_test(), False)108 self.assertTrue(self._tsc.is_empty())109 def test_adding_tag_to_selected_tests(self):110 tests = [self._create_test('test%d' % i) for i in range(10)]111 for t in tests:112 self._tsc.select(t)113 self._tsc.add_tag('foo')114 for t in tests:115 self.assertEqual([tag.name for tag in t.tags], ['foo'])116 def test_adding_a_tag_to_test_with_a_default_tag(self):117 test = self._create_test()118 test.datafile_controller.default_tags.execute(ChangeTag(Tag(None), 'default'))119 assert_equals([t.name for t in test.tags], ['default'])120 self._tsc.select(test)121 self._tsc.add_tag('custom')122 self.assertEqual([t.name for t in test.tags], ['default', 'custom'])123 def _create_test(self, name='test'):124 suite = TestCaseFile(source='suite')125 suite_controller = TestCaseFileController(suite)126 parent = TestCaseTableController(suite_controller, suite.testcase_table)127 test = TestCase(parent=lambda:0, name=name)128 return TestCaseController(parent, test)129if __name__ == '__main__':...
wscript
Source: wscript
...94 includes = 'deps/cmocka/include',95 export_includes = 'deps/cmocka/include',96 source = 'deps/cmocka/src/cmocka.c',97 )98 _create_test(ctx, 'tj_array')99 _create_test(ctx, 'tj_buffer')100 _create_test(ctx, 'tj_error')101 _create_test(ctx, 'tj_heap')102 _create_test(ctx, 'tj_log')103 _create_test(ctx, 'tj_searchpathlist')104 if ctx.env.LIB_DL:105 _create_test(ctx, 'tj_solibrary')106 _create_test(ctx, 'tj_template')107 _create_test(ctx, 'tj_util', ['calloc', 'strdup', 'strndup'])108def _create_test(ctx, src, wrappers=None):109 if wrappers is None:110 wrappers = []111 ctx.program(112 features = 'test',113 target = 'test-' + src,114 # Execute test from root project directory, for data files.115 ut_cwd = ctx.top_dir,116 use = ['tj-tools', 'cmocka'],117 source = 'test/test-{}.c'.format(src),118 linkflags = ['-Wl,--wrap=' + symbol for symbol in wrappers],...
test_views.py
Source: test_views.py
...7from kitsune.wiki.tests import LocaleFactory8class TestCreateLocaleAnnouncement(TestCase):9 def setUp(self):10 self.locale = LocaleFactory(locale="es")11 def _create_test(self, status, count):12 """Login, or other setup, then call this."""13 url = reverse("announcements.create_for_locale", locale="es")14 resp = self.client.post(15 url,16 {17 "content": "Look at me!",18 "show_after": "2012-01-01",19 },20 )21 self.assertEqual(resp.status_code, status)22 self.assertEqual(Announcement.objects.count(), count)23 def test_create(self):24 u = UserFactory(is_superuser=1)25 self.client.login(username=u.username, password="testpass")26 self._create_test(200, 1)27 def test_leader(self):28 u = UserFactory()29 self.locale.leaders.add(u)30 self.locale.save()31 self.client.login(username=u.username, password="testpass")32 self._create_test(200, 1)33 def test_has_permission(self):34 u = UserFactory()35 add_permission(u, Announcement, "add_announcement")36 self.client.login(username=u.username, password="testpass")37 self._create_test(200, 1)38 def test_no_perms(self):39 u = UserFactory()40 self.client.login(username=u.username, password="testpass")41 self._create_test(403, 0)42 def test_anon(self):43 self._create_test(302, 0)44class TestDeleteAnnouncement(TestCase):45 def setUp(self):46 self.locale = LocaleFactory(locale="es")47 self.u = UserFactory()48 self.locale.leaders.add(self.u)49 self.locale.save()50 self.announcement = AnnouncementFactory(51 creator=self.u,52 locale=self.locale,53 content="Look at me!",54 show_after=datetime(2012, 1, 1, 0, 0, 0),55 )56 def _delete_test(self, id, status, count):57 """Login, or other setup, then call this."""...
Check out the latest blogs from LambdaTest on this topic:
Before we discuss Scala testing, let us understand the fundamentals of Scala and how this programming language is a preferred choice for your development requirements.The popularity and usage of Scala are rapidly rising, evident by the ever-increasing open positions for Scala developers.
So, now that the first installment of this two fold article has been published (hence you might have an idea of what Agile Testing is not in my opinion), I’ve started feeling the pressure to explain what Agile Testing actually means to me.
Did you know that according to Statista, the number of smartphone users will reach 18.22 billion by 2025? Let’s face it, digital transformation is skyrocketing and will continue to do so. This swamps the mobile app development market with various options and gives rise to the need for the best mobile app testing tools
As a developer, checking the cross browser compatibility of your CSS properties is of utmost importance when building your website. I have often found myself excited to use a CSS feature only to discover that it’s still not supported on all browsers. Even if it is supported, the feature might be experimental and not work consistently across all browsers. Ask any front-end developer about using a CSS feature whose support is still in the experimental phase in most prominent web browsers. ????
The count of mobile users is on a steep rise. According to the research, by 2025, it is expected to reach 7.49 billion users worldwide. 70% of all US digital media time comes from mobile apps, and to your surprise, the average smartphone owner uses ten apps per day and 30 apps each month.
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.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!