{"action":"created","issue":{"url":"https://api.github.com/repos/enthought/traits/issues/212","labels_url":"https://api.github.com/repos/enthought/traits/issues/212/labels{/name}","comments_url":"https://api.github.com/repos/enthought/traits/issues/212/comments","events_url":"https://api.github.com/repos/enthought/traits/issues/212/events","html_url":"https://github.com/enthought/traits/issues/212","id":47429496,"number":212,"title":"`assertTraitChanges` reports chained property events in reverse order","user":{"login":"itziakos","id":403930,"avatar_url":"https://avatars.githubusercontent.com/u/403930?v=3","gravatar_id":"","url":"https://api.github.com/users/itziakos","html_url":"https://github.com/itziakos","followers_url":"https://api.github.com/users/itziakos/followers","following_url":"https://api.github.com/users/itziakos/following{/other_user}","gists_url":"https://api.github.com/users/itziakos/gists{/gist_id}","starred_url":"https://api.github.com/users/itziakos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itziakos/subscriptions","organizations_url":"https://api.github.com/users/itziakos/orgs","repos_url":"https://api.github.com/users/itziakos/repos","events_url":"https://api.github.com/users/itziakos/events{/privacy}","received_events_url":"https://api.github.com/users/itziakos/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/enthought/traits/labels/bug","name":"bug","color":"e10c02"}],"state":"open","locked":false,"assignee":{"login":"mdickinson","id":662003,"avatar_url":"https://avatars.githubusercontent.com/u/662003?v=3","gravatar_id":"","url":"https://api.github.com/users/mdickinson","html_url":"https://github.com/mdickinson","followers_url":"https://api.github.com/users/mdickinson/followers","following_url":"https://api.github.com/users/mdickinson/following{/other_user}","gists_url":"https://api.github.com/users/mdickinson/gists{/gist_id}","starred_url":"https://api.github.com/users/mdickinson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mdickinson/subscriptions","organizations_url":"https://api.github.com/users/mdickinson/orgs","repos_url":"https://api.github.com/users/mdickinson/repos","events_url":"https://api.github.com/users/mdickinson/events{/privacy}","received_events_url":"https://api.github.com/users/mdickinson/received_events","type":"User","site_admin":false},"milestone":null,"comments":4,"created_at":"2014-10-31T18:28:06Z","updated_at":"2015-01-06T11:46:57Z","closed_at":null,"body":"The following example demonstrates the problem. Please note that the calculation takes place correctly\r\n\r\n```python\r\nfrom traits.api import Int, HasStrictTraits, Property\r\nfrom traits.testing.unittest_tools import unittest, UnittestTools\r\n\r\n\r\nclass MyClass(HasStrictTraits):\r\n\r\n    value = Int\r\n    \r\n    new_value = Property(Int, depends_on='value')\r\n    \r\n    new_new_value = Property(Int, depends_on='new_value')\r\n    \r\n    def _get_new_value(self):\r\n        print 'I was called first'\r\n        return self.value + 10\r\n\r\n    def _get_new_new_value(self):\r\n        print 'I was called second' \r\n        return self.new_value + 10\r\n        \r\n    \r\nclass TestMyClass(unittest.TestCase, UnittestTools):\r\n\r\n    \r\n    def test_my_class(self):\r\n    \r\n        my_class = MyClass()\r\n        \r\n        traits = 'new_value,new_new_value'\r\n        with self.assertTraitChanges(my_class, traits, count=2) as collected:\r\n            my_class.value = 5\r\n        names = [event[1] for event in collected.events]\r\n        # this will fail with names having the reverse order.\r\n        self.assertEqual(names, ['new_value', 'new_new_value'])\r\n\r\n\r\nif __name__ == '__main__':\r\n    unittest.main()\r\n```"},"comment":{"url":"https://api.github.com/repos/enthought/traits/issues/comments/68856153","html_url":"https://github.com/enthought/traits/issues/212#issuecomment-68856153","issue_url":"https://api.github.com/repos/enthought/traits/issues/212","id":68856153,"user":{"login":"itziakos","id":403930,"avatar_url":"https://avatars.githubusercontent.com/u/403930?v=3","gravatar_id":"","url":"https://api.github.com/users/itziakos","html_url":"https://github.com/itziakos","followers_url":"https://api.github.com/users/itziakos/followers","following_url":"https://api.github.com/users/itziakos/following{/other_user}","gists_url":"https://api.github.com/users/itziakos/gists{/gist_id}","starred_url":"https://api.github.com/users/itziakos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/itziakos/subscriptions","organizations_url":"https://api.github.com/users/itziakos/orgs","repos_url":"https://api.github.com/users/itziakos/repos","events_url":"https://api.github.com/users/itziakos/events{/privacy}","received_events_url":"https://api.github.com/users/itziakos/received_events","type":"User","site_admin":false},"created_at":"2015-01-06T11:46:57Z","updated_at":"2015-01-06T11:46:57Z","body":">  Why do you consider this a bug? I don't think we make guarantees about the orders of firing of Traits listeners.\r\n\r\nI am considering this a **bug** in the `assertTraitChanges` not in the trait listeners. I would expect that the assert method will report trait changes in the order they where fired by the traits listener machinery.  The solution would be to use the trait change recording mechanism."}}