From 184629e2b99612c7b99fd6a40417a0612048b2cd Mon Sep 17 00:00:00 2001 From: picca Date: Wed, 7 Jan 2015 11:08:32 +0100 Subject: [PATCH] fix a segmentation fault with the HklSampleReflection in the binding. - test deletion of objects in the python binding. - rewrite the hkl-type.c with a macro to be a lot more maintainable. - use a fake ref and unref method for the HklSampleReflection type. - fix all the binding test of the documentation --- Documentation/sphinx/Makefile.am | 6 +- Documentation/sphinx/source/bindings/python.py | 2 +- Documentation/sphinx/source/pyplots/trajectory.py | 2 +- .../sphinx/source/pyplots/trajectory_full.py | 2 +- .../sphinx/source/pyplots/trajectory_simple.py | 5 +- hkl/hkl-binding-private.h | 2 +- hkl/hkl-binding.c | 8 +- hkl/hkl-sample.c | 2 +- hkl/hkl-types.c | 309 +++++---------------- hkl/hkl-types.h | 9 - tests/bindings/python.py | 18 +- 11 files changed, 93 insertions(+), 272 deletions(-) mode change 100644 => 100755 Documentation/sphinx/source/bindings/python.py mode change 100644 => 100755 Documentation/sphinx/source/pyplots/trajectory.py mode change 100644 => 100755 Documentation/sphinx/source/pyplots/trajectory_full.py mode change 100644 => 100755 Documentation/sphinx/source/pyplots/trajectory_simple.py rewrite hkl/hkl-types.c (85%) diff --git a/Documentation/sphinx/Makefile.am b/Documentation/sphinx/Makefile.am index 73a0e3fa..49f00b7f 100644 --- a/Documentation/sphinx/Makefile.am +++ b/Documentation/sphinx/Makefile.am @@ -1,5 +1,5 @@ -TESTS_ENVIRONMENT=env GI_TYPELIB_PATH=$(top_builddir)/hkl $(LIBTOOL) --mode=execute -dlopen $(top_builddir)/hkl/libhkl.la python -TESTS = \ +TESTS_ENVIRONMENT=env GI_TYPELIB_PATH=$(top_builddir)/hkl $(LIBTOOL) --mode=execute -dlopen $(top_builddir)/hkl/libhkl.la +TESTS =\ source/bindings/python.py \ source/pyplots/trajectory_full.py \ source/pyplots/trajectory_simple.py @@ -28,4 +28,4 @@ EXTRA_DIST = \ -include $(top_srcdir)/sphinx.make publish: html - rsync -avz build/html/ picca@people.debian.org:public_html/hkl \ No newline at end of file + rsync -avz build/html/ picca@people.debian.org:public_html/hkl diff --git a/Documentation/sphinx/source/bindings/python.py b/Documentation/sphinx/source/bindings/python.py old mode 100644 new mode 100755 index cfb813a8..eb8f2499 --- a/Documentation/sphinx/source/bindings/python.py +++ b/Documentation/sphinx/source/bindings/python.py @@ -1,4 +1,4 @@ -#!/bin/env python +#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of the hkl library. diff --git a/Documentation/sphinx/source/pyplots/trajectory.py b/Documentation/sphinx/source/pyplots/trajectory.py old mode 100644 new mode 100755 index 9836b68f..00a98c73 --- a/Documentation/sphinx/source/pyplots/trajectory.py +++ b/Documentation/sphinx/source/pyplots/trajectory.py @@ -1,4 +1,4 @@ -#!/bin/env python +#!/usr/bin/env python # -*- coding: utf-8 -*- import math diff --git a/Documentation/sphinx/source/pyplots/trajectory_full.py b/Documentation/sphinx/source/pyplots/trajectory_full.py old mode 100644 new mode 100755 index 0723624c..13c3689e --- a/Documentation/sphinx/source/pyplots/trajectory_full.py +++ b/Documentation/sphinx/source/pyplots/trajectory_full.py @@ -1,4 +1,4 @@ -#!/bin/env python +#!/usr/bin/env python # -*- coding: utf-8 -*- import math diff --git a/Documentation/sphinx/source/pyplots/trajectory_simple.py b/Documentation/sphinx/source/pyplots/trajectory_simple.py old mode 100644 new mode 100755 index 8e3f13dd..cb1bb91b --- a/Documentation/sphinx/source/pyplots/trajectory_simple.py +++ b/Documentation/sphinx/source/pyplots/trajectory_simple.py @@ -1,13 +1,14 @@ -#!/bin/env python +#!/usr/bin/env python # -*- coding: utf-8 -*- import math import numpy +import matplotlib.pyplot as plt + from gi.repository import GLib from gi.repository import Hkl -import matplotlib.pyplot as plt sample = Hkl.Sample.new("toto") lattice = Hkl.Lattice.new(1.54, 1.54, 1.54, diff --git a/hkl/hkl-binding-private.h b/hkl/hkl-binding-private.h index 227133bd..140e9868 100644 --- a/hkl/hkl-binding-private.h +++ b/hkl/hkl-binding-private.h @@ -81,7 +81,7 @@ HKLAPI GSList* hkl_engine_list_engines_get_as_gslist(HklEngineList *self); /* HklSample */ /*************/ -HKLAPI const GSList *hkl_sample_reflections_get(const HklSample *self); +HKLAPI GSList *hkl_sample_reflections_get(const HklSample *self); HKLAPI HklSampleReflection *hkl_sample_add_reflection_binding(HklSample *self, const HklGeometry *geometry, diff --git a/hkl/hkl-binding.c b/hkl/hkl-binding.c index 71b4e27b..3e9dc40e 100644 --- a/hkl/hkl-binding.c +++ b/hkl/hkl-binding.c @@ -271,10 +271,10 @@ GSList* hkl_engine_list_engines_get_as_gslist(HklEngineList *self) * hkl_sample_reflections_get: * @self: the this ptr * - * Return value: (element-type HklSampleReflection) (transfer container): list of reflecions, + * Return value: (element-type HklSampleReflection) (transfer container): list of reflections, * free the list with g_slist_free when done. */ -const GSList *hkl_sample_reflections_get(const HklSample *self) +GSList *hkl_sample_reflections_get(const HklSample *self) { GSList *list = NULL; HklSampleReflection *reflection; @@ -294,9 +294,9 @@ const GSList *hkl_sample_reflections_get(const HklSample *self) * @h: the h coordinate * @k: the k coordinate * @l: the l coordinate + * @error: return location for a GError, or NULL * - * Return value: (element-type HklEngine) (transfer container): list of engines, - * free the list with g_slist_free when done. + * Return value: (transfer none): the newly created HklSampleReflection * * Rename to: hkl_sample_add_reflection **/ diff --git a/hkl/hkl-sample.c b/hkl/hkl-sample.c index a4cdee02..dc02e5d9 100644 --- a/hkl/hkl-sample.c +++ b/hkl/hkl-sample.c @@ -681,7 +681,7 @@ HklSampleReflection *hkl_sample_reflections_next_get(HklSample *self, } /** - * hkl_sample_add_reflection: (skip) + * hkl_sample_add_reflection: * @self: the this ptr * @reflection: The reflection to add * diff --git a/hkl/hkl-types.c b/hkl/hkl-types.c dissimilarity index 85% index 4cd3b1ca..f37dffa3 100644 --- a/hkl/hkl-types.c +++ b/hkl/hkl-types.c @@ -1,246 +1,63 @@ -/* This file is part of the hkl library. - * - * The hkl library is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * The hkl library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with the hkl library. If not, see . - * - * Copyright (C) 2011-2014 Synchrotron SOLEIL - * L'Orme des Merisiers Saint-Aubin - * BP 48 91192 GIF-sur-YVETTE CEDEX - * - * Authors: Picca Frédéric-Emmanuel - */ -#include -#include "hkl-types.h" -#include "glib/gthread.h" // for g_once_init_enter, etc -#include "glibconfig.h" // for gsize -#include "hkl-detector-private.h" // for hkl_detector_new_copy -#include "hkl-geometry-private.h" // for hkl_geometry_list_free, etc -#include "hkl-matrix-private.h" // for hkl_matrix_dup -#include "hkl-pseudoaxis-private.h" // for hkl_engine_list_new_copy -#include "hkl-sample-private.h" // for hkl_sample_reflection_free, etc -#include "hkl-unit-private.h" // for hkl_unit_dup, hkl_unit_free -#include "hkl-vector-private.h" // for hkl_vector_dup, etc - -GType hkl_vector_get_type (void) { - static volatile gsize hkl_vector_type_id__volatile = 0; - if (g_once_init_enter (&hkl_vector_type_id__volatile)) { - GType hkl_vector_type_id; - hkl_vector_type_id = g_boxed_type_register_static ("HklVector", - (GBoxedCopyFunc) hkl_vector_dup, - (GBoxedFreeFunc) hkl_vector_free); - g_once_init_leave (&hkl_vector_type_id__volatile, hkl_vector_type_id); - } - return hkl_vector_type_id__volatile; -} - -GType hkl_matrix_get_type (void) { - static volatile gsize hkl_matrix_type_id__volatile = 0; - if (g_once_init_enter (&hkl_matrix_type_id__volatile)) { - GType hkl_matrix_type_id; - hkl_matrix_type_id = g_boxed_type_register_static ("HklMatrix", - (GBoxedCopyFunc) hkl_matrix_dup, - (GBoxedFreeFunc) hkl_matrix_free); - g_once_init_leave (&hkl_matrix_type_id__volatile, hkl_matrix_type_id); - } - return hkl_matrix_type_id__volatile; -} - -GType hkl_unit_get_type (void) { - static volatile gsize hkl_unit_type_id__volatile = 0; - if (g_once_init_enter (&hkl_unit_type_id__volatile)) { - GType hkl_unit_type_id; - hkl_unit_type_id = g_boxed_type_register_static ("HklUnit", - (GBoxedCopyFunc) hkl_unit_dup, - (GBoxedFreeFunc) hkl_unit_free); - g_once_init_leave (&hkl_unit_type_id__volatile, hkl_unit_type_id); - } - return hkl_unit_type_id__volatile; -} - -GType hkl_parameter_get_type (void) { - static volatile gsize hkl_parameter_type_id__volatile = 0; - if (g_once_init_enter (&hkl_parameter_type_id__volatile)) { - GType hkl_parameter_type_id; - hkl_parameter_type_id = g_boxed_type_register_static ("HklParameter", - (GBoxedCopyFunc) hkl_parameter_new_copy, - (GBoxedFreeFunc) hkl_parameter_free); - g_once_init_leave (&hkl_parameter_type_id__volatile, hkl_parameter_type_id); - } - return hkl_parameter_type_id__volatile; -} - -static HklEngine* hkl_parameter_list_fake_ref(HklEngine *src) -{ - return src; -} - -static void hkl_parameter_list_fake_unref(HklEngine *src) -{ - return; -} - -GType hkl_parameter_list_get_type (void) { - static volatile gsize hkl_parameter_list_type_id__volatile = 0; - if (g_once_init_enter (&hkl_parameter_list_type_id__volatile)) { - GType hkl_parameter_list_type_id; - hkl_parameter_list_type_id = g_boxed_type_register_static ("HklParameterList", - (GBoxedCopyFunc) hkl_parameter_list_fake_ref, - (GBoxedFreeFunc) hkl_parameter_list_fake_unref); - g_once_init_leave (&hkl_parameter_list_type_id__volatile, hkl_parameter_list_type_id); - } - return hkl_parameter_list_type_id__volatile; -} - -GType hkl_axis_get_type (void) { - static volatile gsize hkl_axis_type_id__volatile = 0; - if (g_once_init_enter (&hkl_axis_type_id__volatile)) { - GType hkl_axis_type_id; - hkl_axis_type_id = g_boxed_type_register_static ("HklAxis", - (GBoxedCopyFunc) hkl_parameter_new_copy, - (GBoxedFreeFunc) hkl_parameter_free); - g_once_init_leave (&hkl_axis_type_id__volatile, hkl_axis_type_id); - } - return hkl_axis_type_id__volatile; -} - -GType hkl_geometry_get_type (void) { - static volatile gsize hkl_geometry_type_id__volatile = 0; - if (g_once_init_enter (&hkl_geometry_type_id__volatile)) { - GType hkl_geometry_type_id; - hkl_geometry_type_id = g_boxed_type_register_static ("HklGeometry", - (GBoxedCopyFunc) hkl_geometry_new_copy, - (GBoxedFreeFunc) hkl_geometry_free); - g_once_init_leave (&hkl_geometry_type_id__volatile, hkl_geometry_type_id); - } - return hkl_geometry_type_id__volatile; -} - -GType hkl_geometry_list_item_get_type (void) { - static volatile gsize hkl_geometry_list_item_type_id__volatile = 0; - if (g_once_init_enter (&hkl_geometry_list_item_type_id__volatile)) { - GType hkl_geometry_list_item_type_id; - hkl_geometry_list_item_type_id = g_boxed_type_register_static ("HklGeometryListItem", - (GBoxedCopyFunc) hkl_geometry_list_item_new_copy, - (GBoxedFreeFunc) hkl_geometry_list_item_free); - g_once_init_leave (&hkl_geometry_list_item_type_id__volatile, hkl_geometry_list_item_type_id); - } - return hkl_geometry_list_item_type_id__volatile; -} - -GType hkl_geometry_list_get_type (void) { - static volatile gsize hkl_geometry_list_type_id__volatile = 0; - if (g_once_init_enter (&hkl_geometry_list_type_id__volatile)) { - GType hkl_geometry_list_type_id; - hkl_geometry_list_type_id = g_boxed_type_register_static ("HklGeometryList", - (GBoxedCopyFunc) hkl_geometry_list_new_copy, - (GBoxedFreeFunc) hkl_geometry_list_free); - g_once_init_leave (&hkl_geometry_list_type_id__volatile, hkl_geometry_list_type_id); - } - return hkl_geometry_list_type_id__volatile; -} - -GType hkl_detector_get_type (void) { - static volatile gsize hkl_detector_type_id__volatile = 0; - if (g_once_init_enter (&hkl_detector_type_id__volatile)) { - GType hkl_detector_type_id; - hkl_detector_type_id = g_boxed_type_register_static ("HklDetector", - (GBoxedCopyFunc) hkl_detector_new_copy, - (GBoxedFreeFunc) hkl_detector_free); - g_once_init_leave (&hkl_detector_type_id__volatile, hkl_detector_type_id); - } - return hkl_detector_type_id__volatile; -} - -GType hkl_lattice_get_type (void) { - static volatile gsize hkl_lattice_type_id__volatile = 0; - if (g_once_init_enter (&hkl_lattice_type_id__volatile)) { - GType hkl_lattice_type_id; - hkl_lattice_type_id = g_boxed_type_register_static ("HklLattice", - (GBoxedCopyFunc) hkl_lattice_new_copy, - (GBoxedFreeFunc) hkl_lattice_free); - g_once_init_leave (&hkl_lattice_type_id__volatile, hkl_lattice_type_id); - } - return hkl_lattice_type_id__volatile; -} - -GType hkl_sample_reflection_get_type (void) { - static volatile gsize hkl_sample_reflection_type_id__volatile = 0; - if (g_once_init_enter (&hkl_sample_reflection_type_id__volatile)) { - GType hkl_sample_reflection_type_id; - hkl_sample_reflection_type_id = g_boxed_type_register_static ("HklSampleReflection", - (GBoxedCopyFunc) hkl_sample_reflection_new_copy, - (GBoxedFreeFunc) hkl_sample_reflection_free); - g_once_init_leave (&hkl_sample_reflection_type_id__volatile, hkl_sample_reflection_type_id); - } - return hkl_sample_reflection_type_id__volatile; -} - -GType hkl_sample_get_type (void) { - static volatile gsize hkl_sample_type_id__volatile = 0; - if (g_once_init_enter (&hkl_sample_type_id__volatile)) { - GType hkl_sample_type_id; - hkl_sample_type_id = g_boxed_type_register_static ("HklSample", - (GBoxedCopyFunc) hkl_sample_new_copy, - (GBoxedFreeFunc) hkl_sample_free); - g_once_init_leave (&hkl_sample_type_id__volatile, hkl_sample_type_id); - } - return hkl_sample_type_id__volatile; -} - -GType hkl_pseudo_axis_get_type (void) { - static volatile gsize hkl_pseudo_axis_type_id__volatile = 0; - if (g_once_init_enter (&hkl_pseudo_axis_type_id__volatile)) { - GType hkl_pseudo_axis_type_id; - hkl_pseudo_axis_type_id = g_boxed_type_register_static ("HklPseudoAxis", - (GBoxedCopyFunc) hkl_parameter_new_copy, - (GBoxedFreeFunc) hkl_parameter_free); - g_once_init_leave (&hkl_pseudo_axis_type_id__volatile, hkl_pseudo_axis_type_id); - } - return hkl_pseudo_axis_type_id__volatile; -} - -static HklEngine* hkl_engine_fake_ref(HklEngine *src) -{ - return src; -} - -static void hkl_engine_fake_unref(HklEngine *src) -{ - return; -} - -GType hkl_engine_get_type (void) { - static volatile gsize hkl_engine_type_id__volatile = 0; - if (g_once_init_enter (&hkl_engine_type_id__volatile)) { - GType hkl_engine_type_id; - hkl_engine_type_id = g_boxed_type_register_static ( - "HklEngine", - (GBoxedCopyFunc) hkl_engine_fake_ref, - (GBoxedFreeFunc) hkl_engine_fake_unref); - g_once_init_leave (&hkl_engine_type_id__volatile, hkl_engine_type_id); - } - return hkl_engine_type_id__volatile; -} - -GType hkl_engine_list_get_type (void) { - static volatile gsize hkl_engine_list_type_id__volatile = 0; - if (g_once_init_enter (&hkl_engine_list_type_id__volatile)) { - GType hkl_engine_list_type_id; - hkl_engine_list_type_id = g_boxed_type_register_static ( - "HklEngineList", - (GBoxedCopyFunc) hkl_engine_list_new_copy, - (GBoxedFreeFunc) hkl_engine_list_free); - g_once_init_leave (&hkl_engine_list_type_id__volatile, hkl_engine_list_type_id); - } - return hkl_engine_list_type_id__volatile; -} +/* This file is part of the hkl library. + * + * The hkl library is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * The hkl library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with the hkl library. If not, see . + * + * Copyright (C) 2011-2014 Synchrotron SOLEIL + * L'Orme des Merisiers Saint-Aubin + * BP 48 91192 GIF-sur-YVETTE CEDEX + * + * Authors: Picca Frédéric-Emmanuel + */ +#include +#include "hkl-types.h" +#include "glib/gthread.h" // for g_once_init_enter, etc +#include "glibconfig.h" // for gsize +#include "hkl-detector-private.h" // for hkl_detector_new_copy +#include "hkl-geometry-private.h" // for hkl_geometry_list_free, etc +#include "hkl-matrix-private.h" // for hkl_matrix_dup +#include "hkl-pseudoaxis-private.h" // for hkl_engine_list_new_copy +#include "hkl-sample-private.h" // for hkl_sample_reflection_free, etc +#include "hkl-unit-private.h" // for hkl_unit_dup, hkl_unit_free +#include "hkl-vector-private.h" // for hkl_vector_dup, etc + +#define HKL_TYPE(type, camelcase_type, copy, free) \ + GType hkl_## type ## _get_type (void) { \ + static volatile gsize hkl_type_id__volatile = 0; \ + if (g_once_init_enter (&hkl_type_id__volatile)) { \ + GType hkl_type_id; \ + hkl_type_id = g_boxed_type_register_static ( \ + #camelcase_type, \ + (GBoxedCopyFunc) copy, \ + (GBoxedFreeFunc) free); \ + g_once_init_leave (&hkl_type_id__volatile, hkl_type_id); \ + } \ + return hkl_type_id__volatile; \ + } + +static void * hkl_fake_ref(void *src) { return src; } +static void hkl_fake_unref(void *src) { return; } + +HKL_TYPE(detector, HklDetector, hkl_detector_new_copy, hkl_detector_free); +HKL_TYPE(engine, HklEngine, hkl_fake_ref, hkl_fake_unref); +HKL_TYPE(engine_list, HklEngineList, hkl_engine_list_new_copy, hkl_engine_list_free); +HKL_TYPE(geometry, HklGeometry, hkl_geometry_new_copy, hkl_geometry_free); +HKL_TYPE(geometry_list, HklGeometryList, hkl_geometry_list_new_copy, hkl_geometry_list_free); +HKL_TYPE(geometry_list_item, HklGeometryListItem, hkl_geometry_list_item_new_copy, hkl_geometry_list_item_free); +HKL_TYPE(lattice, HklLattice, hkl_lattice_new_copy, hkl_lattice_free); +HKL_TYPE(matrix, HklMatrix, hkl_matrix_dup, hkl_matrix_free); +HKL_TYPE(parameter, HklParameter, hkl_parameter_new_copy, hkl_parameter_free); +HKL_TYPE(sample, HklSample, hkl_sample_new_copy, hkl_sample_free); +HKL_TYPE(sample_reflection, HklSampleReflection, hkl_fake_ref, hkl_fake_unref); +HKL_TYPE(unit, HklUnit, hkl_unit_dup, hkl_unit_free); +HKL_TYPE(vector, HklVector, hkl_vector_dup, hkl_vector_free); diff --git a/hkl/hkl-types.h b/hkl/hkl-types.h index 878d01e6..8af6b2da 100644 --- a/hkl/hkl-types.h +++ b/hkl/hkl-types.h @@ -39,12 +39,6 @@ HKLAPI GType hkl_unit_get_type (void) G_GNUC_CONST; #define TYPE_HKL_PARAMETER (hkl_parameter_get_type ()) HKLAPI GType hkl_parameter_get_type (void) G_GNUC_CONST; -#define TYPE_HKL_PARAMETER_LIST (hkl_parameter_list_get_type ()) -HKLAPI GType hkl_parameter_list_get_type (void) G_GNUC_CONST; - -#define TYPE_HKL_AXIS (hkl_axis_get_type ()) -HKLAPI GType hkl_axis_get_type (void) G_GNUC_CONST; - #define TYPE_HKL_GEOMETRY (hkl_geometry_get_type ()) HKLAPI GType hkl_geometry_get_type (void) G_GNUC_CONST; @@ -66,9 +60,6 @@ HKLAPI GType hkl_sample_reflection_get_type (void) G_GNUC_CONST; #define TYPE_HKL_SAMPLE (hkl_sample_get_type ()) HKLAPI GType hkl_sample_get_type (void) G_GNUC_CONST; -#define TYPE_HKL_PSEUDO_AXIS (hkl_pseudo_axis_get_type ()) -HKLAPI GType hkl_pseudo_axis_get_type (void) G_GNUC_CONST; - #define TYPE_HKL_ENGINE (hkl_engine_get_type ()) HKLAPI GType hkl_engine_get_type (void) G_GNUC_CONST; diff --git a/tests/bindings/python.py b/tests/bindings/python.py index b516ac3c..a7afbbb9 100755 --- a/tests/bindings/python.py +++ b/tests/bindings/python.py @@ -49,6 +49,8 @@ class TestAPI(unittest.TestCase): engines = factory.create_new_engine_list() self.assertTrue(type(engines) == Hkl.EngineList) + del factories + def test_detector_api(self): """ enforce the detector API @@ -58,6 +60,8 @@ class TestAPI(unittest.TestCase): detector = Hkl.Detector.factory_new(Hkl.DetectorType(0)) self.assertTrue(type(detector) is Hkl.Detector) + del detector + def test_geometry_api(self): """ enforce the geometry API @@ -85,6 +89,8 @@ class TestAPI(unittest.TestCase): axis.min_max_set(0, math.radians(180), Hkl.UnitEnum.USER) geometry.axis_set(name, axis) + del geometry + def test_engine_api(self): """ enforce the HklEngine API @@ -237,6 +243,9 @@ class TestAPI(unittest.TestCase): reciprocal = lattice.copy() lattice.reciprocal(reciprocal) + del sample + del lattice + def test_reflection_api(self): detector = Hkl.Detector.factory_new(Hkl.DetectorType(0)) @@ -258,13 +267,16 @@ class TestAPI(unittest.TestCase): self.assertTrue(r2.hkl_get() == (1.0, 0.0, 1.0)) # compute the angles - print sample.get_reflection_mesured_angle(r1, r2) - print sample.get_reflection_theoretical_angle(r1, r2) + sample.get_reflection_mesured_angle(r1, r2) + sample.get_reflection_theoretical_angle(r1, r2) # remove all the reflections reflections = sample.reflections_get() for reflection in reflections: sample.del_reflection(reflection) + del reflections + del sample + if __name__ == '__main__': - unittest.main() + unittest.main(verbosity=2) -- 2.11.4.GIT