Best Python code snippet using localstack_python
orm.py
Source: orm.py
...11 Base.metadata.create_all(bind=self.engine)12 self.session = Session()13 def tearDown(self) -> None:14 self.session.close()15 def test_create_tag(self):16 tag = create_tag(self.session, 'teste')17 print(tag)18 self.assertEqual(tag.name, 'teste')19 return tag20 def test_create_insight_with_new_tag(self):21 new_insight = NewInsight(texto='teste de insight', tags=['teste'])22 insight = create_insight(self.session, new_insight)23 print(insight)24 self.assertEqual(insight.texto, 'teste de insight')25 return insight26 def test_list_all_insight(self):27 insight = self.test_create_insight_with_new_tag()28 insights = list_cards(self.session)29 print(insights)30 self.assertListEqual(insights, [insight])31 def test_delete_insight(self):32 tag = self.test_create_tag()33 insight = self.test_create_insight_with_new_tag()34 delete_insight(self.session, insight.id)35 insights = list_cards(self.session)36 print(insights)37 self.session.refresh(tag)38 self.assertListEqual(insights, [])39 self.assertListEqual(tag.insights, [])40 def test_create_insight_with_old_tag(self):41 tag = self.test_create_tag()42 insight = self.test_create_insight_with_new_tag()43 print(tag, insight, sep='\n')44 self.assertEqual(insight.tags[0], tag)45 return insight46 def test_update_tag_ok(self):47 tag = self.test_create_tag()48 new_tag = update_tag(self.session, tag.id, Tag(name='teste2'))49 print(new_tag)50 self.assertEqual(new_tag.name, 'teste2')51 def test_update_tag_nok(self):52 tag = self.test_create_tag()53 with self.assertRaises(ValueError):54 new_tag = update_tag(self.session, tag.id, Tag(name=tag.name))55 print(new_tag)56 def test_update_insight_ok(self):57 insight = self.test_create_insight_with_new_tag()58 new_insight = update_insight(self.session, insight.id, NewInsight(texto='Teste 2 de insight', tags=['teste2']))59 print(new_insight)60 self.assertEqual(insight.id, new_insight.id)61 self.assertEqual(insight.texto, 'Teste 2 de insight')62 self.assertEqual(len(insight.tags), 1)63 self.assertEqual(insight.tags[0].name, 'teste2')64 def test_update_insight_nok(self):65 insight = self.test_create_insight_with_new_tag()66 with self.assertRaises(ValueError):67 new_insight = update_insight(self.session, insight.id, NewInsight(texto=insight.texto, tags=insight.tags))68 print(new_insight)69 def test_delete_tag(self):70 tag = self.test_create_tag()71 insight = self.test_create_insight_with_new_tag()72 delete_tag(self.session, tag.id)73 self.session.refresh(insight)74 print(insight)75 self.assertListEqual(insight.tags, [])76 def test_list_insights(self):77 trash = [78 create_insight(self.session, NewInsight(texto=f'Teste {i}', tags=[f'teste{k}' for k in range(j)]))79 for i in range(3)80 for j in range(3)81 ]82 test_insights = [83 create_insight(self.session, NewInsight(texto=f'Teste {i}', tags=['teste3'])) for i in range(5)84 ]...
test_image_tags_resource.py
Source: test_image_tags_resource.py
...21 def setUp(self):22 super(TestImageTagsController, self).setUp()23 self.db = unit_test_utils.FakeDB()24 self.controller = glance.api.v2.image_tags.Controller(self.db)25 def test_create_tag(self):26 request = unit_test_utils.get_fake_request()27 self.controller.update(request, unit_test_utils.UUID1, 'dink')28 context = request.context29 tags = self.db.image_tag_get_all(context, unit_test_utils.UUID1)30 self.assertEqual(1, len([tag for tag in tags if tag == 'dink']))31 def test_create_duplicate_tag_ignored(self):32 request = unit_test_utils.get_fake_request()33 self.controller.update(request, unit_test_utils.UUID1, 'dink')34 self.controller.update(request, unit_test_utils.UUID1, 'dink')35 context = request.context36 tags = self.db.image_tag_get_all(context, unit_test_utils.UUID1)37 self.assertEqual(1, len([tag for tag in tags if tag == 'dink']))38 def test_delete_tag(self):39 request = unit_test_utils.get_fake_request()40 self.controller.delete(request, unit_test_utils.UUID1, 'ping')41 def test_delete_tag_not_found(self):42 request = unit_test_utils.get_fake_request()43 self.assertRaises(webob.exc.HTTPNotFound, self.controller.delete,44 request, unit_test_utils.UUID1, 'what')45class TestImagesSerializer(test_utils.BaseTestCase):46 def setUp(self):47 super(TestImagesSerializer, self).setUp()48 self.serializer = glance.api.v2.image_tags.ResponseSerializer()49 def test_create_tag(self):50 response = webob.Response()51 self.serializer.update(response, None)52 self.assertEqual(204, response.status_int)53 def test_delete_tag(self):54 response = webob.Response()55 self.serializer.delete(response, None)...
test_tag.py
Source: test_tag.py
2"""3å
¬å¸æµè¯ç¨ä¾4"""5class TestTag:6 def test_create_tag(self):7 print("[TestTag] ===== test_create_tag >>> æµè¯äºå建Tag, token 为[%s]" % global_value.TOKEN)...
Check out the latest blogs from LambdaTest on this topic:
The fact is not alien to us anymore that cross browser testing is imperative to enhance your application’s user experience. Enhanced knowledge of popular and highly acclaimed testing frameworks goes a long way in developing a new app. It holds more significance if you are a full-stack developer or expert programmer.
QA testers have a unique role and responsibility to serve the customer. Serving the customer in software testing means protecting customers from application defects, failures, and perceived failures from missing or misunderstood requirements. Testing for known requirements based on documentation or discussion is the core of the testing profession. One unique way QA testers can both differentiate themselves and be innovative occurs when senseshaping is used to improve the application user experience.
Having a good web design can empower business and make your brand stand out. According to a survey by Top Design Firms, 50% of users believe that website design is crucial to an organization’s overall brand. Therefore, businesses should prioritize website design to meet customer expectations and build their brand identity. Your website is the face of your business, so it’s important that it’s updated regularly as per the current web design trends.
Enterprise resource planning (ERP) is a form of business process management software—typically a suite of integrated applications—that assists a company in managing its operations, interpreting data, and automating various back-office processes. The introduction of a new ERP system is analogous to the introduction of a new product into the market. If the product is not handled appropriately, it will fail, resulting in significant losses for the business. Most significantly, the employees’ time, effort, and morale would suffer as a result of the procedure.
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!!