Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test and update the Observer.py code #212

Merged
merged 1 commit into from
Oct 15, 2024

Conversation

kurtmckee
Copy link
Contributor

Added

  • Add tests for the Observer.py code, bringing the file up to 100% code coverage.
  • Add type annotations to the Observer code.

Changed

  • Use the mutex lock as a context manager.

    Previous behavior was to call .acquire() and .release().

  • Use .copy() instead of [:] syntax to make a copy of the observer list.

  • Set .changed directly in .notifyObservers().

    Previous behavior was to call .clearChanged(). This resulted in multiple unnecessary functions calls due to the synchronization decorator and RLock re-acquisition.

  • Use super().__init__() syntax.

Added
-----

* Add tests for the `Observer.py` code,
  bringing the file up to 100% code coverage.
* Add type annotations to the Observer code.

Changed
-------

* Use the mutex lock as a context manager.

  Previous behavior was to call `.acquire()` and `.release()`.

* Use `.copy()` instead of `[:]` syntax
  to make a copy of the observer list.

* Set `.changed` directly in `.notifyObservers()`.

  Previous behavior was to call `.clearChanged()`.
  This resulted in multiple unnecessary functions calls
  due to the synchronization decorator and RLock re-acquisition.

* Use `super().__init__()` syntax.
@coveralls
Copy link

coveralls commented Oct 15, 2024

Coverage Status

coverage: 65.413% (+0.6%) from 64.764%
when pulling e0f2060 on kurtmckee:test-observer
into 4452941 on LudovicRousseau:master.

@LudovicRousseau LudovicRousseau merged commit 042ab5f into LudovicRousseau:master Oct 15, 2024
26 checks passed
@kurtmckee kurtmckee deleted the test-observer branch October 15, 2024 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants