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 > <type 'function'> > > > > > 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() > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > -------------------------------------------------------------- > > > ---------------------------------- > > > Full test output: > > > > > > ERROR: Test activate() > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test yield hold and simulate(until) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test request > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test request2 with capacity = 1 > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test request3 with capacity = 1 several requests > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test request4 with capacity = 2 several requests > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test PriorityQ, with no preemption, 0 capacity > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test PriorityQ, with no preemption, capacity == 1 > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test PriorityQ, with preemption, capacity == 1 > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test preemption of preemptor > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: test monitoring of number in the two queues, waitQ and > > > activeQ > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test Monitor - observe with time being picked up from now() > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test Monitor - accumulate over simulation time > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test plot histogram > > > > -------------------------------------------------------------------- > > > -- <type 'NameError'>: name 'SimPlot' not defined > > > > > > > ==================================================================== > > > == > > > ERROR: testInterrupt1 (__main__.makeInterrupttestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testInterrupt2 (__main__.makeInterrupttestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testInterrupt3 (__main__.makeInterrupttestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testInterrupt4 (__main__.makeInterrupttestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testInterrupt5 (__main__.makeInterrupttestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testState1 (__main__.makePStatetestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testState2 (__main__.makePStatetestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testState3 (__main__.makePStatetestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testState4 (__main__.makePStatetestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testSimEvents2 (__main__.makeEtestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testSimEvents3 (__main__.makeEtestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Tests that eventsFired reports all events which fired > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Tests that eventsFired reports all events which fired > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testwaituntil1 (__main__.makeWtestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > FAIL: Test some Monitor list operations > > > > -------------------------------------------------------------------- > > > -- <type 'AssertionError'>: item in list wrong > > > > > > > -------------------------------------------------------------------- > > > -- > > > Ran 41 tests in 0.280s > > > > > > > > > ERROR: Test activate() > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test yield hold and simulate(until) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test request > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test request2 with capacity = 1 > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test request3 with capacity = 1 several requests > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test request4 with capacity = 2 several requests > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test PriorityQ, with no preemption, 0 capacity > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test PriorityQ, with no preemption, capacity == 1 > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test PriorityQ, with preemption, capacity == 1 > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test preemption of preemptor > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: test monitoring of number in the two queues, waitQ and > > > activeQ > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test Monitor - observe with time being picked up from now() > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test Monitor - accumulate over simulation time > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Test plot histogram > > > > -------------------------------------------------------------------- > > > -- <type 'NameError'>: name 'SimPlot' not defined > > > > > > > ==================================================================== > > > == > > > ERROR: testInterrupt1 (__main__.makeInterrupttestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testInterrupt2 (__main__.makeInterrupttestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testInterrupt3 (__main__.makeInterrupttestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testInterrupt4 (__main__.makeInterrupttestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testInterrupt5 (__main__.makeInterrupttestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testState1 (__main__.makePStatetestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testState2 (__main__.makePStatetestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testState3 (__main__.makePStatetestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testState4 (__main__.makePStatetestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testSimEvents2 (__main__.makeEtestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testSimEvents3 (__main__.makeEtestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Tests that eventsFired reports all events which fired > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: Tests that eventsFired reports all events which fired > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > ERROR: testwaituntil1 (__main__.makeWtestcase) > > > > -------------------------------------------------------------------- > > > -- <class 'SimPy.Simulation.Simerror'>: "Fatal SimPy error: > > > activating function whi ch is not a generator (contains > no 'yield')" > > > > > > > ==================================================================== > > > == > > > FAIL: Test some Monitor list operations > > > > -------------------------------------------------------------------- > > > -- <type 'AssertionError'>: item in list wrong > > > > > > > -------------------------------------------------------------------- > > > -- > > > Ran 41 tests in 0.280s > > > > > > > > > > > > > > > > > > ------------------------------------------------------- > > > This SF.net email is sponsored by: Splunk Inc. Do you > grep through > > > log files for problems? Stop! Download the new AJAX > search engine > > > that makes searching your log files as easy as surfing the web. > > > DOWNLOAD SPLUNK! > > > http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click > > > _______________________________________________ > > > Simpy-users mailing list > > > [EMAIL PROTECTED] > > > https://lists.sourceforge.net/lists/listinfo/simpy-users > > > > > > > > > > > >
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ users mailing list users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com