Best Python code snippet using toolium_python
test_extract.py
Source:test_extract.py
...100 [su1],101 [x for x in view.get_statusupdates()])102 def test_extract_attachment_png(self):103 su = StatusUpdate('A', microblog_context=self.mock_workspace1)104 su.add_attachment(self.png_name, self.png_data)105 self.statuscontainer.add(su)106 num_attachments = self.view.extract()107 self.assertEquals(1, num_attachments)108 # the original stream attachment is removed109 self.assertEquals([], [x for x in su.attachments.keys()])110 def test_extract_attachment_odt(self):111 su = StatusUpdate('A', microblog_context=self.mock_workspace1)112 su.add_attachment(self.odt_name, self.odt_data)113 self.statuscontainer.add(su)114 num_attachments = self.view.extract()115 self.assertEquals(1, num_attachments)116 # the original stream attachment is removed117 self.assertEquals([], [x for x in su.attachments.keys()])118 def test_extract_ignores_global_statusupdate(self):119 su = StatusUpdate('A')120 su.add_attachment(self.odt_name, self.odt_data)121 self.statuscontainer.add(su)122 num_attachments = self.view.extract()123 self.assertEquals(0, num_attachments)124 def test_extract_ignores_statusupdate_without_attachment(self):125 su = StatusUpdate('A', microblog_context=self.mock_workspace1)126 self.statuscontainer.add(su)127 num_attachments = self.view.extract()128 self.assertEquals(0, num_attachments)129 def test_extract_ignores_content_updates(self):130 su = StatusUpdate('A', microblog_context=self.mock_workspace1,131 content_context=self.mock_folder)132 su.add_attachment(self.odt_name, self.odt_data)133 self.statuscontainer.add(su)134 num_attachments = self.view.extract()135 self.assertEquals(0, num_attachments)136 def test_extraction_creates_incoming_folder(self):137 su = StatusUpdate('A', microblog_context=self.mock_workspace1)138 su.add_attachment(self.odt_name, self.odt_data)139 self.statuscontainer.add(su)140 num_attachments = self.view.extract()141 self.assertEquals(1, num_attachments)142 self.assertIn(u'INCOMING', self.mock_workspace1)143 def test_extraction_creates_incoming_file(self):144 su = StatusUpdate('A', microblog_context=self.mock_workspace1)145 su.add_attachment(self.odt_name, self.odt_data)146 self.statuscontainer.add(su)147 num_attachments = self.view.extract()148 self.assertEquals(1, num_attachments)149 self.assertIn(u'INCOMING', self.mock_workspace1)150 self.assertIn(self.simple_odt_name, self.mock_workspace1.INCOMING)151 content = self.mock_workspace1.INCOMING[self.simple_odt_name]152 self.assertEquals(self.odt_name, content.file.filename)153 self.assertEquals(self.odt_data, content.file.data)154 def test_extraction_creates_incoming_image(self):155 su = StatusUpdate('A', microblog_context=self.mock_workspace1)156 su.add_attachment(self.png_name, self.png_data)157 self.statuscontainer.add(su)158 num_attachments = self.view.extract()159 self.assertEquals(1, num_attachments)160 self.assertIn(u'INCOMING', self.mock_workspace1)161 self.assertIn(self.png_name, self.mock_workspace1.INCOMING)162 content = self.mock_workspace1.INCOMING[self.png_name]163 self.assertEquals(self.png_name, content.image.filename)164 self.assertEquals(self.png_data, content.image.data)165 def test_extraction_content_context(self):166 su = StatusUpdate('A', microblog_context=self.mock_workspace1)167 su.add_attachment(self.odt_name, self.odt_data)168 self.statuscontainer.add(su)169 self.view.extract()170 content = self.mock_workspace1.INCOMING[self.simple_odt_name]171 self.assertEquals(content, su.content_context)172 def test_extraction_content_context_indexed(self):173 su = StatusUpdate('A', microblog_context=self.mock_workspace1)174 su.add_attachment(self.odt_name, self.odt_data)175 self.statuscontainer.add(su)176 self.view.extract()177 content = self.mock_workspace1.INCOMING[self.simple_odt_name]178 self.assertEquals(179 [su],180 [x for x in self.statuscontainer.content_values(content)])181 def test_extraction_metadata_title(self):182 su = StatusUpdate('A', microblog_context=self.mock_workspace1)183 su.add_attachment(self.odt_name, self.odt_data)184 self.statuscontainer.add(su)185 self.view.extract()186 content = self.mock_workspace1.INCOMING[self.simple_odt_name]187 self.assertEquals(self.odt_name, content.title)188 def test_extraction_metadata_creator(self):189 api.user.create('killroy@example.org', 'killroy')190 su = StatusUpdate('A', microblog_context=self.mock_workspace1,191 userid='killroy')192 su.add_attachment(self.odt_name, self.odt_data)193 self.statuscontainer.add(su)194 self.view.extract()195 content = self.mock_workspace1.INCOMING[self.simple_odt_name]196 self.assertEquals(('killroy',), content.creators)197 def test_extraction_metadata_created(self):198 su = StatusUpdate('A', microblog_context=self.mock_workspace1)199 su.add_attachment(self.odt_name, self.odt_data)200 su.date = DateTime(2015, 01, 01)201 self.statuscontainer.add(su)202 self.view.extract()203 content = self.mock_workspace1.INCOMING[self.simple_odt_name]204 self.assertEquals(su.date, content.created())205 def test_extraction_metadata_owner(self):206 killroy = api.user.create('killroy@example.org', 'killroy')207 su = StatusUpdate('A', microblog_context=self.mock_workspace1,208 userid='killroy')209 su.add_attachment(self.odt_name, self.odt_data)210 self.statuscontainer.add(su)211 self.view.extract()212 content = self.mock_workspace1.INCOMING[self.simple_odt_name]213 self.assertEquals('killroy', content.getOwner().getId())214 self.assertIn('Owner', api.user.get_roles(username='killroy',215 obj=content))...
character_specific_weapons.py
Source:character_specific_weapons.py
...10from .grenade_pack import GrenadePack11def LuminaDMR() -> ProjectLadaDMR:12 return (13 ProjectLadaDMR()14 .add_attachment(PlasmaChamber())15 .add_attachment(EMChamber())16 .add_attachment(APChamber())17 .add_attachment(TelescopicSight())18 .add_attachment(Bipod())19 .add_attachment(Suppressor())20 .add_attachment(SpecializedTraining())21 )22def LuminaPistol() -> CoalitionPistol:23 return (24 CoalitionPistol()25 .add_attachment(HolographicSight())26 .add_attachment(Suppressor())27 .add_attachment(BasicTraining())28 )29def LuminaGrenades() -> GrenadePack:30 return GrenadePack(31 ammo_count = {32 "Flashbang": (2, 4),33 "Concussion": (2, 4),34 "Fragmentation": (0, 4),35 "Smoke": (0, 4),36 },37 )38def GalinaBR() -> ProjectLadaBR:39 return (40 ProjectLadaBR()41 .add_attachment(Suppressor())42 .add_attachment(HolographicSight())43 .add_attachment(EMChamber())44 .add_attachment(PlasmaChamber())45 .add_attachment(APChamber())46 .add_attachment(SpecializedTraining())47 )48def GalinaSplaser() -> ProjectSplazer:49 return ProjectSplazer().add_attachment(BasicTraining())50def GalinaGrenadeLauncher() -> UnderbarrelGrenadeLauncher:51 return UnderbarrelGrenadeLauncher().add_attachment(BasicTraining())52def GalinaGrenades() -> GrenadePack:53 return GrenadePack(54 ammo_count = {55 "Flashbang": (2, 4),56 "Concussion": (0, 4),57 "Fragmentation": (0, 4),58 "Smoke": (2, 4),59 },60 )61def SilviaLSW() -> ProjectVesnaLSW:62 return (63 ProjectVesnaLSW()64 .add_attachment(Bipod())65 .add_attachment(Suppressor())66 .add_attachment(HolographicSight())67 .add_attachment(PlasmaChamber())68 .add_attachment(EMChamber())69 .add_attachment(APChamber())70 .add_attachment(SpecializedTraining())71 )72def SilviaPistol() -> CoalitionPistol:73 return (74 CoalitionPistol()75 .add_attachment(HolographicSight())76 .add_attachment(Suppressor())77 .add_attachment(BasicTraining())78 )79def SilviaGrenades() -> GrenadePack:80 return GrenadePack(81 ammo_count = {82 "Flashbang": (2, 4),83 "Concussion": (0, 4),84 "Fragmentation": (0, 4),85 "Smoke": (2, 4),86 },...
urls.py
Source:urls.py
1from django.conf.urls import url2from .views import add_attachment, add_attachment_done3urlpatterns = [4 url(r'^add_attachment/$', add_attachment, name="add_attachment"),5 url(r'^add_attachment_done/$', add_attachment_done, name="add_attachment_done"),6 url(r'^$', add_attachment, name="add_attachment"),...
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!!