Closed PascalLesage closed 4 years ago
Can't reproduce - how do you get a StopIteration
error?
[_ for _ in c1.ancestors]
returns an empty list on my system. No error is raised.
c1.parent_id
is None
Hence,
if not self.parent_id:
raise StopIteration
I have tested this in a brand new conda environment with presamples master branch taken directly from the pascallesage conda channel:
Submitted a PR, hopefully it makes this go away. So weird, I don't get this at all, either conceptually or on my machine.
On Thu, 21 Nov 2019 at 16:57, PascalLesage notifications@github.com wrote:
c1.parent_id is None Hence,
if not self.parent_id: raise StopIteration
I have tested this in a brand new conda environment with presamples master branch taken directly from the pascallesage conda channel: [image: image] https://user-images.githubusercontent.com/16614268/69354004-713c1700-0c4d-11ea-9d80-88cc0bf00567.png [image: image] https://user-images.githubusercontent.com/16614268/69354012-7600cb00-0c4d-11ea-9789-df63760586a9.png [image: image] https://user-images.githubusercontent.com/16614268/69354030-7a2ce880-0c4d-11ea-9f2a-a7ad5c8f9563.png [image: image] https://user-images.githubusercontent.com/16614268/69354164-a8aac380-0c4d-11ea-826c-31c8344b437d.png
— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://github.com/PascalLesage/presamples/issues/61?email_source=notifications&email_token=AAE5QYKDONR5QCHFZF2WTQLQU2VV3A5CNFSM4JNPM6I2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEE2WYQI#issuecomment-557149249, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAE5QYLDSRADCDCRJO3MD7LQU2VV3ANCNFSM4JNPM6IQ .
-- ############################ Chris Mutel Technology Assessment Group, LEA Paul Scherrer Institut OHSA D22 5232 Villigen PSI Switzerland http://chris.mutel.org Telefon: +41 56 310 5787 ############################
I didn't get it, conceptually, either, but hesitated getting rid of it without checking in first since it was from you.
Given:
c1 = Campaign.create(name='a')
which is a campaign with no parent, calling
c1.ancestors()
returns an iterator of ancestors (there are none). Iterating raises a
StopIteration
error, as specified here.This means that , for example, both
[_ for _ in c1.ancestors]
, andlist(c1.ancestors)
return aStopIteration
error.While this is fine, it does not appear to be the expected behaviour based on this test.
Need to agree on expected bahaviour and fix either code or test.