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

DM-19582: Add cross-language GenericMap unit tests #486

Merged
merged 12 commits into from Sep 20, 2019
Merged

Conversation

kfindeisen
Copy link
Member

@kfindeisen kfindeisen commented Sep 17, 2019

This PR adds unit tests to GenericMap that pass objects from Python to C++ and/or vice versa. This exposes behavior that was not adequately tested with previous tests.

Bugs fixed:

  • Building afw with Scons no longer issues an "ignoring a non-existent file" warning
  • GenericMap's policy on type conversions is now explicitly described in the API docs
  • Python builtin integers are no longer demoted to int, nor Python floats to float, when inserted into a GenericMap (but see DM-21268, below)
  • Storable values (i.e., non-pointers) can now be retrieved from a GenericMap in Python
  • Storage and retrieval of integers in C++ now work consistently across platforms

Bugs deferred:

  • GenericMap's weakly-typed insert method turns C-strings into bool [DM-21216].
  • GenericMap cannot consistently handle integers and floats from Python, particularly Numpy's explicit-length types [DM-21268].
  • A Python Storable may be prematurely garbage-collected [DM-21314].

C++ considers int, long, and long long fundamentally different types
(even though in practice two of the three will be identical), so one
of the three does not map correctly to either int32_t or int64_t.
Inexact matching was previously documented only in the CLO
announcement and the design documentation.
Copy link
Member

@TallJimbo TallJimbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Only very minor in-line comments.

python/lsst/afw/typehandling/_GenericMap.cc Show resolved Hide resolved
tests/test_simpleGenericMap.py Outdated Show resolved Hide resolved
include/lsst/afw/typehandling/GenericMap.h Show resolved Hide resolved
This commit fixes a bug where Storable values could not be read
from Python.
The garbage collection bug is a significant restriction on Storable,
and providing a non-passing unit test makes this fact more
self-documenting.
@kfindeisen kfindeisen merged commit d7581c2 into master Sep 20, 2019
@kfindeisen kfindeisen deleted the tickets/DM-19582 branch September 20, 2019 21:01
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.

None yet

2 participants