On 16/04/17 00:17, boB Stepp wrote:

> --------------------------------------------------------------------------------------
> #!/usr/bin/env python3
> 
> def mySuperWhammyFunction(any_input):
>     return any_input

This is a simple function, its not bound to an object

> 
> import unittest
> 
> class TestFuncAcceptsSequencesMixin:
> 
>     func = mySuperWhammyFunction
> 
>     def test_func(self):
>         self.func(self.arg)

This is calling self.function which implies a method.

Convert your function to a method and it should work.

> ERROR: test_func (test_super.AcceptLists)
> ----------------------------------------------------------------------
> Traceback (most recent call last):
>   File "c:\Projects\test_super.py", line 13, in test_func
>     self.func(self.arg)
> TypeError: mySuperWhammyFunction() takes 1 positional argument but 2 were 
> given

The missing self parameter...

> I suspect that both an object instance and self.arg is getting passed

Its self.
When you do

object.method()

object gets passed as the first parameter (traditionally
called self) But because your function is not a method
it does not expect a self to be passed.

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to