Best Python code snippet using autotest_python
error.py
Source:error.py  
...180        return ("Subcommand %s failed with exit code %d" %181                (self.func, self.exit_code))182class AutoservHardwareRepairRequestedError(AutoservError):183    """184    Exception class raised from Host.repair_full() (or overrides) when software185    repair fails but it successfully managed to request a hardware repair (by186    notifying the staff, sending mail, etc)187    """188    pass189# This MUST remain at the end of the file.190# Limit 'from error import *' to only import the exception instances.191for _name, _thing in locals().items():192    try:193        if issubclass(_thing, Exception):194            __all__.append(_name)195    except TypeError:196        pass  # _thing not a class...views.py
Source:views.py  
...70        messages.add_message(request, messages.SUCCESS, 'You repair one.')71    return HttpResponseRedirect(reverse('smithy_repair', args=[slug]))    72@hero_init73@in_given_location74def repair_full(request, slug, herothing_id):75    hero = request.hero76    try:77        building = Building.objects.get(slug=slug)78        herothing = hero.herothing_set.get(id=herothing_id, dressed=False,79                                           away=False,)80    except (Building.DoesNotExist, HeroThing.DoesNotExist):81        return HttpResponseRedirect(reverse(settings.URL_REVERSE_404))82    smithy = building.buildingsmithy_set.get()83    count = herothing.stability_left - herothing.stability_all84    price = count * (herothing.thing.price * \85                                        (smithy.percent_repair_money / 100))86    if hero.money < price:87#88        messages.add_message(request, messages.ERROR,...urls.py
Source:urls.py  
1from django.conf.urls.defaults import patterns, url2urlpatterns = patterns('building.module.smithy.views',3                       url(r'^(?P<slug>[-\w]+)$', 'index', name='smithy'),4                       # Repair5                       url(r'^(?P<slug>[-\w]+)/repair$', 'repair', 6                           name='smithy_repair'), 7                       url(r'^(?P<slug>[-\w]+)/repairone/'8                           '(?P<herothing_id>\d+)$', 'repair_one',9                           name='smithy_repair_one'),10                       url(r'^(?P<slug>[-\w]+)/repairfull/'11                           '(?P<herothing_id>\d+)$', 'repair_full',12                           name='smithy_repair_full'),13                       # Modify14                       url(r'^(?P<slug>[-\w]+)/modify$', 'modify', 15                           name='smithy_modify'),16                       url(r'^(?P<slug>[-\w]+)/modifyselect/'17                            '(?P<id_herothing>\d+)/(?P<id_smithyfeature>\d+)$', 18                           'modify_select', name='smithy_modify_select'),...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!!
