Best Python code snippet using autotest_python
urls.py
Source: urls.py
1from django.conf.urls import patterns, include, url2from django.contrib import admin3urlpatterns = patterns('',4 5 # Route for built-in authentication with our own custom login page6 url(r'^loginandregister$', 'django.contrib.auth.views.login', {'template_name':'foodchaser/registerandlogin.html'}, name='login'),7 # Route to logout a user and send them back to the login page8 url(r'^logout$', 'django.contrib.auth.views.logout_then_login'),9 url(r'^register$', 'foodchaser.views.register', name='register'),10 url(r'^userhome$', 'foodchaser.views.userhome', name='home'),11 url(r'^trial$', 'foodchaser.views.trial'),12 url(r'^recommend$', 'foodchaser.views.recommendpage', name='recommend'),13 url(r'^menuplanner$', 'foodchaser.views.menuplanner', name='menuplanner'),14 # any token produced by the default_token_generator15 url(r'^confirm-registration/(?P<username>[a-zA-Z0-9_@\+\-]+)/(?P<token>[a-z0-9\-]+)$', 'foodchaser.views.confirm_registration', name='confirm'),16 url(r'^add_recipe$', 'foodchaser.handle_recipe.add_recipe', name='add_recipe'),17 url(r'^confirm-reset-password/(?P<username>[a-zA-Z0-9_@\+\-]+)/(?P<new_password>[a-zA-Z0-9_@\+\- ]+)/(?P<token>[a-z0-9\-]+)$', 'foodchaser.views.confirm_resetpassword', name='confirmpassword'),18 url(r'^changepassword$', 'foodchaser.views.change_password'),19 url(r'^recipebox_maindish$', 'foodchaser.handle_recipe.recipebox_maindish', name='recipebox_maindish'),20 21 url(r'^recipe_view/(?P<id>\d+)$', 'foodchaser.handle_recipe.recipe_view', name='recipe_view'),22 23 url(r'^search$', 'foodchaser.handle_recipe.search', name='search'),24 url(r'^recipe/photo/(?P<id>\d+)$', 'foodchaser.views.get_recipe_picture'),25 26 url(r'^step/photo/(?P<id>\d+)$', 'foodchaser.views.get_step_picture'),27 url(r'^rate$', 'foodchaser.handle_recipe.rate', name='rate'),28 url(r'^comment$', 'foodchaser.handle_recipe.comment', name='comment'),29 url(r'^settings$', 'foodchaser.views.settings_page', name='settings'),30 url(r'^virtual_restaurant$', 'foodchaser.views.virtual_restaurant', name='virtual_restaurant'),31 url(r'^virtual_restaurant_menu$', 'foodchaser.views.virtual_restaurant_menu', name='virtual_restaurant_menu'),32 url(r'^favorites$', 'foodchaser.views.get_favorites', name='favorites'),33 url(r'^add_favorite/(?P<id>\d+)$', 'foodchaser.views.add_favorite', name='add_favorite'),34 url(r'^preference$', 'foodchaser.views.preference', name='preference'),35 url(r'^add-dislike$', 'foodchaser.views.add_dislike', name='dislike'),36 37 url(r'^edit/(?P<id>\d+)$', 'foodchaser.handle_recipe.edit', name='edit'),38 url(r'^save_planner$', 'foodchaser.views.save_planner', name='save_planner'),39 url(r'^get_planner$', 'foodchaser.views.get_planner', name='get_planner'),40 41 url(r'^delete/(?P<id>\d+)$', 'foodchaser.handle_recipe.delete', name='delete'),42 url(r'^changemyprofile$', 'foodchaser.views.changemyprofile'),43 url(r'^leftover$', 'foodchaser.views.use_leftover', name='leftover'),44 url(r'^suggest-leftover$', 'foodchaser.views.suggest_leftover', name='suggest_leftover')...
sanitize_xml.py
Source: sanitize_xml.py
...6count = 07doc = xml.dom.minidom.Document()8oldjob = xml.dom.minidom.parseString(open(sys.argv[1]).read()).getElementsByTagName('job')[0]9newjob = doc.createElement('job')10def handle_recipe(element, node):11 global count12 new_r = doc.createElement(element)13 new_r.setAttribute('result', node.getAttribute('result'))14 new_r.setAttribute('status', node.getAttribute('status'))15 new_r.setAttribute('whiteboard', '')16 new_dr = doc.createElement('distroRequires')17 new_dn = doc.createElement('distro_name')18 new_dn.setAttribute('op','=')19 new_dn.setAttribute('value','BlueShoeLinux5-5')20 new_dr.appendChild(new_dn)21 new_r.appendChild(new_dr)22 new_r.appendChild(doc.createElement('hostRequires'))23 for child in node.childNodes:24 if child.nodeName == 'guestrecipe':25 new_r.appendChild(handle_recipe('guestrecipe', child))26 if child.nodeName == 'task':27 new_t = doc.createElement('task')28 if child.getAttribute('name') not in tasks:29 tasks[child.getAttribute('name')] = '/fake/Task/task%s' % count30 count += 131 new_t.setAttribute('name', tasks[child.getAttribute('name')])32 new_t.setAttribute('result', child.getAttribute('result'))33 new_t.setAttribute('status', child.getAttribute('status'))34 new_r.appendChild(new_t)35 return new_r36 37newjob.setAttribute('result', oldjob.getAttribute('result'))38newjob.setAttribute('status', oldjob.getAttribute('status'))39newjob.appendChild(doc.createElement('whiteboard'))40for old_rs in oldjob.getElementsByTagName('recipeSet'):41 new_rs = doc.createElement('recipeSet')42 for child in old_rs.childNodes:43 if child.nodeName == 'recipe':44 new_r = handle_recipe('recipe', child)45 new_rs.appendChild(new_r)46 newjob.appendChild(new_rs)...
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!!