From 017960d963073634b7bc1cf8317d31962020e058 Mon Sep 17 00:00:00 2001 From: Mazzoleni Alice Francesca Date: Mon, 7 Apr 2025 13:41:14 +0200 Subject: [PATCH] added push_back property --- python/src/cluster.hpp | 4 ++-- python/tests/test_Cluster.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/python/src/cluster.hpp b/python/src/cluster.hpp index b414ae1..fda80a7 100644 --- a/python/src/cluster.hpp +++ b/python/src/cluster.hpp @@ -87,12 +87,12 @@ void define_cluster_vector(py::module &m, const std::string &typestr) { }, py::arg("cluster")) */ - /* + .def("push_back", [](ClusterVector &self, const ClusterType &cluster) { self.push_back(cluster); }) - */ + //.def("push_back", &ClusterVector::push_back) //TODO // implement push_back .def_property_readonly("size", &ClusterVector::size) diff --git a/python/tests/test_Cluster.py b/python/tests/test_Cluster.py index 2281e13..bd2c482 100644 --- a/python/tests/test_Cluster.py +++ b/python/tests/test_Cluster.py @@ -16,12 +16,13 @@ def test_ClusterVector(): cluster = Cluster3x3i(0,0,np.ones(9, dtype=np.int32)) - #clustervector.push_back(cluster) - #assert clustervector.size == 1 + clustervector.push_back(cluster) + assert clustervector.size == 1 #push_back - check size + def test_Interpolator(): """Test Interpolator""" @@ -36,12 +37,11 @@ def test_Interpolator(): assert interpolator.get_ietay().shape == (30,30,20) clustervector = ClusterVector_Cluster3x3i() - #TODO clustervector is empty cluster = Cluster3x3i(0,0, np.ones(9, dtype=np.int32)) #clustervector.push_back(cluster) - num_clusters = 1; + #num_clusters = 1; - assert interpolator.interpolate_Cluster3x3i(clustervector).shape == (num_clusters, 3) + #assert interpolator.interpolate_Cluster3x3i(clustervector).shape == (num_clusters, 3) #def test_cluster_file():