classmethod lambda Python -


I have a hard time understanding this piece of code. I understand that to save the time of testing, Instead of the end point, some are using fake.

I do not understand that Klassemp (Lambda CLS: Self Preprop) is the structure. What does the use of Lambda CLS mean if I do not use all the CLS inside the code?

I hope that I am quite clear, I would be very happy if someone can put a light this one ..

Thanks a lot

  @patch ("paypaladaptive.api.endpoints.UrlRequest", MockUrlRequestPreapproval) def test_preapproval (self):. # I do not understand this code, it is very confusing self.assertTrue (self.preapproval.process (why: why do I use a lambda structure if I code myself in the code (self.preapproval) MockUrlRequestPreapproval .preapproval = (self.preapproval) need to not use classmethod (lambda CLS)) self.preapproval = Preapproval.objects.get (p = self.preapproval.pk) self.assertNotEqual (self.preapproval.preapproval_key, "") Self.assertEqual (self.preapproval.status, "created")  

'First argument should be such a task, in which one Be Rk or more. There will be an error in making any call to this:

  classmethod (self.preapproval) # Not a function classmethod (lambda: self.preapproval) # Need a logic  < / Pre> 

This works, but it is very verbose:

  def get_preapproval (CLS): self.preapproval classmethod (get_preapproval) returned  
< P> This is the reason that the code uses Lambda

A small maybe this correction can be done:.

  classmethod (lambda _: self.preapproval)  

It makes it clear that logic is not required.


Comments

Popular posts from this blog

c# - SignalR: "Protocol error: Unknown transport." when navigating to hub -

class - Kivy: how to instantiate a dynamic classes in python -

python - mayavi mapping a discrete colorbar on a surface -