Skip to content
Snippets Groups Projects
Commit 5f32fcc5 authored by Tiago de Freitas Pereira's avatar Tiago de Freitas Pereira
Browse files

Merge branch '2-issue-when-the-nodes-of-the-graph-are-set-manually' into 'master'

Fixed small bug in the  constructor

Closes #2

See merge request !5
parents a38816f3 f903505c
No related branches found
No related tags found
1 merge request!5Fixed small bug in the constructor
Pipeline #
...@@ -69,7 +69,7 @@ BOB_TRY ...@@ -69,7 +69,7 @@ BOB_TRY
auto k_ = make_safe(k); auto k_ = make_safe(k);
if ( if (
(kwargs && PyDict_Contains(kwargs, k)) || (kwargs && PyDict_Contains(kwargs, k)) ||
(args && PyBobIoHDF5File_Check(PyTuple_GetItem(args, 0))) (PyTuple_Size(args)>0 && PyBobIoHDF5File_Check(PyTuple_GetItem(args, 0)))
){ ){
PyBobIoHDF5FileObject* hdf5; PyBobIoHDF5FileObject* hdf5;
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&", kwlist1, &PyBobIoHDF5File_Converter, &hdf5)) return -1; if (!PyArg_ParseTupleAndKeywords(args, kwargs, "O&", kwlist1, &PyBobIoHDF5File_Converter, &hdf5)) return -1;
......
...@@ -209,12 +209,26 @@ def test_graph(): ...@@ -209,12 +209,26 @@ def test_graph():
assert graph.number_of_nodes == 30 assert graph.number_of_nodes == 30
assert graph.nodes[0] == (10,10) assert graph.nodes[0] == (10,10)
assert graph.nodes[-1] == (90,60) assert graph.nodes[-1] == (90,60)
# set graph nodes
# set graph nodes
graph.nodes = [(0,0), (1,1)] graph.nodes = [(0,0), (1,1)]
assert graph.number_of_nodes == 2 assert graph.number_of_nodes == 2
assert graph.nodes[0] == (0,0) assert graph.nodes[0] == (0,0)
assert graph.nodes[1] == (1,1) assert graph.nodes[1] == (1,1)
# Create graph with kwargs
graph = bob.ip.gabor.Graph(nodes=[(0,0), (1,1)])
assert graph.number_of_nodes == 2
assert graph.nodes[0] == (0,0)
assert graph.nodes[1] == (1,1)
# Create graph with args
graph = bob.ip.gabor.Graph([(0,0), (1,1)])
assert graph.number_of_nodes == 2
assert graph.nodes[0] == (0,0)
assert graph.nodes[1] == (1,1)
# create graph # create graph
graph = bob.ip.gabor.Graph((177,148), (191,142), between=3, above=1, along=1, below=4) graph = bob.ip.gabor.Graph((177,148), (191,142), between=3, above=1, along=1, below=4)
assert graph.number_of_nodes == 42 assert graph.number_of_nodes == 42
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment