Re: [IronPython] [Simpy-users] Simpy under IronPython 0.96
Stan, Your assertion must be: assert type(gentest()) == types.GeneratorType, _not_: assert type(gentest) == types.GeneratorType. The call of a generator function generates a generator object. Klaus Müller > -Original Message- > From: Stanislas Pinte [mailto:[EMAIL PROTECTED] > Sent: Friday, December 16, 2005 5:48 PM > To: Klaus Muller > Cc: [EMAIL PROTECTED]; users@lists.ironpython.com > Subject: RE: [Simpy-users] Simpy under IronPython 0.96 > > > > > if not (type(process) == types.GeneratorType): > > raise Simerror("Fatal SimPy error: activating > function which"+ > >" is not a generator (contains no 'yield')") > > > > I suspect that the type system on IronPython is somehow > different from > > that in CPython. > > given test.py: > > #from __future__ import generators > import types > def gentest(): > for i in range(0,10): > yield i > > #assert type(gentest) == types.GeneratorType print > type(gentest) assert isinstance(gentest,types.GeneratorType) > > [bin]> ./IronPythonConsole.exe test.py > > > > > > Could you check what e.g. the type of a generator is? > > > > Klaus Müller > > > > > -Original Message- > > > From: [EMAIL PROTECTED] > > > [mailto:[EMAIL PROTECTED] On Behalf Of > > > Stanislas Pinte > > > Sent: Friday, December 16, 2005 5:29 PM > > > To: [EMAIL PROTECTED] > > > Cc: users@lists.ironpython.com > > > Subject: [Simpy-users] Simpy under IronPython 0.96 > > > > > > Hello, > > > > > > I am trying to start unit testing Simpy under IronPython, > and make a > > > state of current affairs... > > > > > > 1: I had to comment out all the from __future__ import statements. > > > 2: I had to copy the following standard CPython modules in > > > IronPythonConsole.exe directory: > > > > > > [bin]> ls *.py > > > bisect.py* ntpath.py* stat.py* unittest.py* > > > copy_reg.py* os.py* traceback.py* warnings.py* > > > linecache.py* random.py* types.py* [bin]> > > > > > > 3: then running ./IronPythonConsole.exe > SimPy/testSimPy_ip.py gave > > > me: > > > > > > Ran 41 tests in 0.280s > > > > > > FAILED (failures=1, errors=28) > > > > > > I propose we look at the tests one-by-one, and try to solve the > > > problems. > > > > > > First failed test: > > > > > > def testActivate(self): > > > """Test activate() > > > """ > > > P1 = P(name="P1",T=100.0) > > > initialize() > > > activate(P1,P1.execute(),0) > > > simulate(until=5) > > > assert(now()==5),"Simulate stopped at %s not %s"%(now(),5) > > > > > > ERROR: Test activate() > > > > > > > -- : "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > -- > > > -- > > > Full test output: > > > > > > ERROR: Test activate() > > > > > > > -- : "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > > > > == > > > ERROR: Test yield hold and simulate(until) > > > > > > > -- : "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > > > > == > > > ERROR: Test request > > > > > > > -- : "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > > > > == > > > ERROR: Test request2 with capacity = 1 > > > > > > > -- : "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > > > > == > > > ERROR: Test request3 with capacity = 1 several requests > > > > > > > -- : "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > > > > == > > > ERROR: Test request4 with capacity = 2 several requests > > > > > > > -- : "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > > > > == > > > ERROR: Test PriorityQ, with no preemption, 0 capacity > > > > --
Re: [IronPython] [Simpy-users] Simpy under IronPython 0.96
Good work! What type does IronPython actually return for a generator? Klaus Müller > -Original Message- > From: Stanislas Pinte [mailto:[EMAIL PROTECTED] > Sent: Friday, December 16, 2005 6:04 PM > To: Klaus Muller > Cc: [EMAIL PROTECTED]; users@lists.ironpython.com > Subject: RE: [Simpy-users] Simpy under IronPython 0.96 > > Selon Klaus Muller <[EMAIL PROTECTED]>: > > > Stan, > > Your assertion must be: > > assert type(gentest()) == types.GeneratorType, > > > > _not_: > > assert type(gentest) == types.GeneratorType. > > > > The call of a generator function generates a generator object. > > You are right, sorry!! > > there we are: > > [bin]> python test.py > 'import site' failed; use -v for traceback > [bin]> ./IronPythonConsole.exe test.py '__main__+gentest0'> Traceback (most recent call last): >at __main__.Initialize() in c:\Program > Files\IronPython-0.9.6\bin\test.py:lin > e 9 > AssertionError > [bin]> > > So let's file a bug to IronPython... > > > > smime.p7s Description: S/MIME cryptographic signature ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] [Simpy-users] Simpy under IronPython 0.96
Stan, I am so glad that you are getting on with testing SimPy on IronPython! Many of your errors are: > : "Fatal SimPy error: > activating function whi ch is not a generator (contains no 'yield')" This is caught by the following code in function 'activate' in Simulation.py: if not (type(process) == types.GeneratorType): raise Simerror("Fatal SimPy error: activating function which"+ " is not a generator (contains no 'yield')") I suspect that the type system on IronPython is somehow different from that in CPython. Could you check what e.g. the type of a generator is? Klaus Müller > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Stanislas Pinte > Sent: Friday, December 16, 2005 5:29 PM > To: [EMAIL PROTECTED] > Cc: users@lists.ironpython.com > Subject: [Simpy-users] Simpy under IronPython 0.96 > > Hello, > > I am trying to start unit testing Simpy under IronPython, and > make a state of current affairs... > > 1: I had to comment out all the from __future__ import statements. > 2: I had to copy the following standard CPython modules in > IronPythonConsole.exe directory: > > [bin]> ls *.py > bisect.py* ntpath.py* stat.py* unittest.py* > copy_reg.py* os.py* traceback.py* warnings.py* > linecache.py* random.py* types.py* > [bin]> > > 3: then running ./IronPythonConsole.exe SimPy/testSimPy_ip.py > gave me: > > Ran 41 tests in 0.280s > > FAILED (failures=1, errors=28) > > I propose we look at the tests one-by-one, and try to solve > the problems. > > First failed test: > > def testActivate(self): > """Test activate() > """ > P1 = P(name="P1",T=100.0) > initialize() > activate(P1,P1.execute(),0) > simulate(until=5) > assert(now()==5),"Simulate stopped at %s not %s"%(now(),5) > > ERROR: Test activate() > -- > : "Fatal SimPy error: > activating function whi ch is not a generator (contains no 'yield')" > > -- > -- > Full test output: > > ERROR: Test activate() > -- > : "Fatal SimPy error: > activating function whi ch is not a generator (contains no 'yield')" > > == > ERROR: Test yield hold and simulate(until) > -- > : "Fatal SimPy error: > activating function whi ch is not a generator (contains no 'yield')" > > == > ERROR: Test request > -- > : "Fatal SimPy error: > activating function whi ch is not a generator (contains no 'yield')" > > == > ERROR: Test request2 with capacity = 1 > -- > : "Fatal SimPy error: > activating function whi ch is not a generator (contains no 'yield')" > > == > ERROR: Test request3 with capacity = 1 several requests > -- > : "Fatal SimPy error: > activating function whi ch is not a generator (contains no 'yield')" > > == > ERROR: Test request4 with capacity = 2 several requests > -- > : "Fatal SimPy error: > activating function whi ch is not a generator (contains no 'yield')" > > == > ERROR: Test PriorityQ, with no preemption, 0 capacity > -- > : "Fatal SimPy error: > activating function whi ch is not a generator (contains no 'yield')" > > == > ERROR: Test PriorityQ, with no preemption, capacity == 1 > -- > : "Fatal SimPy error: > activating function whi ch is not a generator (contains no 'yield')" > > == > ERROR: Test PriorityQ, with preemption, capacity == 1 > -- > : "Fatal SimPy error: > activating function whi ch is not a generator (contains no 'yield')" > > == > ERROR: Test preemption of preemptor > -- > : "Fatal SimPy error: > activating function whi ch is
Re: [IronPython] [Simpy-users] Simpy under IronPython 0.96
Selon Klaus Muller <[EMAIL PROTECTED]>: > Good work! What type does IronPython actually return for a generator? a generated type... not looking like a generator... Stan. > > Klaus Müller > > > -Original Message- > > From: Stanislas Pinte [mailto:[EMAIL PROTECTED] > > Sent: Friday, December 16, 2005 6:04 PM > > To: Klaus Muller > > Cc: [EMAIL PROTECTED]; users@lists.ironpython.com > > Subject: RE: [Simpy-users] Simpy under IronPython 0.96 > > > > Selon Klaus Muller <[EMAIL PROTECTED]>: > > > > > Stan, > > > Your assertion must be: > > > assert type(gentest()) == types.GeneratorType, > > > > > > _not_: > > > assert type(gentest) == types.GeneratorType. > > > > > > The call of a generator function generates a generator object. > > > > You are right, sorry!! > > > > there we are: > > > > [bin]> python test.py > > 'import site' failed; use -v for traceback > > [bin]> ./IronPythonConsole.exe test.py > '__main__+gentest0'> Traceback (most recent call last): > >at __main__.Initialize() in c:\Program > > Files\IronPython-0.9.6\bin\test.py:lin > > e 9 > > AssertionError > > [bin]> > > > > So let's file a bug to IronPython... > > > > > > > > > ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] [Simpy-users] Simpy under IronPython 0.96
Selon Klaus Muller <[EMAIL PROTECTED]>: > Stan, > Your assertion must be: > assert type(gentest()) == types.GeneratorType, > > _not_: > assert type(gentest) == types.GeneratorType. > > The call of a generator function generates a generator object. You are right, sorry!! there we are: [bin]> python test.py 'import site' failed; use -v for traceback [bin]> ./IronPythonConsole.exe test.py Traceback (most recent call last): at __main__.Initialize() in c:\Program Files\IronPython-0.9.6\bin\test.py:lin e 9 AssertionError [bin]> So let's file a bug to IronPython... ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
Re: [IronPython] [Simpy-users] Simpy under IronPython 0.96
> > if not (type(process) == types.GeneratorType): > raise Simerror("Fatal SimPy error: activating function which"+ >" is not a generator (contains no 'yield')") > > I suspect that the type system on IronPython is somehow different from that > in CPython. given test.py: #from __future__ import generators import types def gentest(): for i in range(0,10): yield i #assert type(gentest) == types.GeneratorType print type(gentest) assert isinstance(gentest,types.GeneratorType) [bin]> ./IronPythonConsole.exe test.py > > Could you check what e.g. the type of a generator is? > > Klaus Müller > > > -Original Message- > > From: [EMAIL PROTECTED] > > [mailto:[EMAIL PROTECTED] On Behalf Of > > Stanislas Pinte > > Sent: Friday, December 16, 2005 5:29 PM > > To: [EMAIL PROTECTED] > > Cc: users@lists.ironpython.com > > Subject: [Simpy-users] Simpy under IronPython 0.96 > > > > Hello, > > > > I am trying to start unit testing Simpy under IronPython, and > > make a state of current affairs... > > > > 1: I had to comment out all the from __future__ import statements. > > 2: I had to copy the following standard CPython modules in > > IronPythonConsole.exe directory: > > > > [bin]> ls *.py > > bisect.py* ntpath.py* stat.py* unittest.py* > > copy_reg.py* os.py* traceback.py* warnings.py* > > linecache.py* random.py* types.py* > > [bin]> > > > > 3: then running ./IronPythonConsole.exe SimPy/testSimPy_ip.py > > gave me: > > > > Ran 41 tests in 0.280s > > > > FAILED (failures=1, errors=28) > > > > I propose we look at the tests one-by-one, and try to solve > > the problems. > > > > First failed test: > > > > def testActivate(self): > > """Test activate() > > """ > > P1 = P(name="P1",T=100.0) > > initialize() > > activate(P1,P1.execute(),0) > > simulate(until=5) > > assert(now()==5),"Simulate stopped at %s not %s"%(now(),5) > > > > ERROR: Test activate() > > -- > > : "Fatal SimPy error: > > activating function whi ch is not a generator (contains no 'yield')" > > > > -- > > -- > > Full test output: > > > > ERROR: Test activate() > > -- > > : "Fatal SimPy error: > > activating function whi ch is not a generator (contains no 'yield')" > > > > == > > ERROR: Test yield hold and simulate(until) > > -- > > : "Fatal SimPy error: > > activating function whi ch is not a generator (contains no 'yield')" > > > > == > > ERROR: Test request > > -- > > : "Fatal SimPy error: > > activating function whi ch is not a generator (contains no 'yield')" > > > > == > > ERROR: Test request2 with capacity = 1 > > -- > > : "Fatal SimPy error: > > activating function whi ch is not a generator (contains no 'yield')" > > > > == > > ERROR: Test request3 with capacity = 1 several requests > > -- > > : "Fatal SimPy error: > > activating function whi ch is not a generator (contains no 'yield')" > > > > == > > ERROR: Test request4 with capacity = 2 several requests > > -- > > : "Fatal SimPy error: > > activating function whi ch is not a generator (contains no 'yield')" > > > > == > > ERROR: Test PriorityQ, with no preemption, 0 capacity > > -- > > : "Fatal SimPy error: > > activating function whi ch is not a generator (contains no 'yield')" > > > > == > > ERROR: Test PriorityQ, with no preemption, capacity == 1 > > -- > > : "Fatal SimPy error: > > activating function whi ch is not a generator (contains no 'yield')" > > > > == > > ERROR: Test PriorityQ, with preemption, capacity == 1 > > -- > > : "Fatal SimPy error: > > activating function whi ch is not a generator (contains no 'yield')" > > > > ==
Re: [IronPython] [Simpy-users] Simpy under IronPython 0.96
I think I have the first idea why the tests are failing: [bin]> ./IronPythonConsole.exe IronPython 0.9.6 on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved. >>> def testgenerator(): .. for i in range(0,10): .. yield i .. >>> testgenerator >>> type(testgenerator) >>> import types >>> type(testgenerator) == types.GeneratorType False >>> --> The problem is that the following code doesn't work with either IronPythonConsole, or standard CPython 2.4. Any idea what I may be missing? Thanks, Stan. > I propose we look at the tests one-by-one, and try to solve the problems. > > First failed test: > > def testActivate(self): > """Test activate() > """ > P1 = P(name="P1",T=100.0) > initialize() > activate(P1,P1.execute(),0) > simulate(until=5) > assert(now()==5),"Simulate stopped at %s not %s"%(now(),5) > > ERROR: Test activate() > -- > : "Fatal SimPy error: activating function > whi > ch is not a generator (contains no 'yield')" > ___ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com