[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] PATCH: Numeric and not numpy by deafault



Hi,

I've seen that in some platforms pygame is using Numeric and not numpy
as default for surfarray module (and probably sndarray, not checked).

pygame docs [0] says that:

"The default will be numpy, if installed. Otherwise, Numeric will be
set as default if installed. If neither numpy nor Numeric are
installed, the module will raise an ImportError. "

I see in What's New:
[SVN 1871-1879] Jan 25, 2009
    Completing the process to actually have numpy be the default.

And efectively it seems that as pygame 1.9.x it is fixed, so i am only
adding a test case patch to make sure it is fixed:

class SurfarrayModuleTest2(unittest.TestCase):
    def setUp(self):
        pass

    def test_default_numpy(self):
    	try:
    		import numpy
    		import Numeric
    	except ImportError:
    		return # If numpy or Numeric is not installed this test has no sense.
    	self.failIf(pygame.surfarray.get_arraytype() == 'numeric')

Note that its needed no add the function in another unittest class
because the setUp method of SurfarrayModuleTest "hardcodes" the
arraytype (just take a look at surfarray_test.py to get what i am
talking about).

Cheers,
SAn

[0] http://www.pygame.org/docs/ref/surfarray.html