LSST Applications 29.2.0,g04e9c324dd+8c5ae1fdc5,g123d84c11c+8c5ae1fdc5,g1567b3d500+b0659b51fd,g1fd858c14a+f0198063e6,g262e1987ae+ddad5971a2,g29a0cc5914+9941618539,g29ae962dfc+65771b1219,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+65596d926d,g47891489e3+f62ff855a3,g4d44eb3520+5e59dfe5df,g53246c7159+8c5ae1fdc5,g667e5db04e+cf951d6fc1,g67b6fd64d1+f62ff855a3,g67fd3c3899+c3deb07ab9,g74acd417e5+29806445f4,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g89139ef638+f62ff855a3,g8d7436a09f+1e696a951a,g8ea07a8fe4+72e50bfcbe,g90f42f885a+232124b352,g97be763408+27a7069373,g9dd6db0277+c3deb07ab9,ga1e959baac+5fbc491aed,ga2a72113ab+fe106acc69,gabf8522325+f227d7ba3a,gac2eed3f23+f62ff855a3,gb89ab40317+f62ff855a3,gceab9eb81a+45f7d1ed17,gd14cc1c8cb+796e414499,gd8ff7fe66e+c3deb07ab9,gdab6d2f7ff+29806445f4,gdc713202bf+c3deb07ab9,ge410e46f29+f62ff855a3,geaed405ab2+2322f1d6ea,gffca2db377+8c5ae1fdc5
LSST Data Management Base Package
Loading...
Searching...
No Matches
test_bindings.py
Go to the documentation of this file.
1# This file is part of gauss2d.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (https://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <https://www.gnu.org/licenses/>.
21
22import lsst.gauss2d as g2d
23
24
26 errors = []
27 bad_args_msg = "incompatible function arguments"
28
29 for name_class in dir(g2d):
30 klass = getattr(g2d, name_class)
31
32 if callable(klass):
33 try:
34 obj = klass()
35 except ValueError:
36 # Likely non-trivial __init__
37 continue
38 except TypeError as e:
39 msg = str(e)
40 if not (
41 msg.endswith("No constructor defined!")
42 or msg.startswith("__init__(): incompatible constructor arguments.")
43 or msg.startswith("extend_path() missing")
44 or (msg.startswith("make_gaussians_pixel") and (bad_args_msg in msg))
45 ):
46 errors.append(e)
47 # str and repr should not raise
48 try:
49 repr(obj)
50 except Exception as e:
51 errors.append(e)
52 try:
53 str(obj)
54 except Exception as e:
55 errors.append(e)
56
57 if errors:
58 print('\n'.join((str(e) for e in errors)))
59 assert not 'errors not empty; see stdout'