File tree Expand file tree Collapse file tree 4 files changed +23
-9
lines changed Expand file tree Collapse file tree 4 files changed +23
-9
lines changed Original file line number Diff line number Diff line change @@ -550,6 +550,10 @@ vector<string> mooseLe(const ObjId& obj)
550
550
{
551
551
vector<Id> children;
552
552
vector<string> chPaths;
553
+
554
+ if (obj.bad ())
555
+ throw pybind11::value_error (" no such element." );
556
+
553
557
Neutral::children (obj.eref (), children);
554
558
stringstream ss;
555
559
ss << " Elements under " << obj.path () << endl;
Original file line number Diff line number Diff line change 1
- // =====================================================================================
1
+ // Description: Python bindings generated by pybind11. This binding replaces
2
+ // binding generated in ../pymoose folder.
2
3
//
3
- // Description: Python bindings generated by pybind11. This binding replaces
4
- // binding generated in ../pymoose folder. These bindings are easier to
5
- // maintain and more performant. The user API has not changed but the
6
- // internal working has changed.
4
+ // These bindings are easier to maintain and more performant. The user API
5
+ // is almost the same but the internal working has changed.
7
6
//
8
- // Author: Dilawar Singh <dilawar.s.rajput@gmail.com>
9
- // Organization: NCBS Bangalore
10
- //
11
- // =====================================================================================
7
+ // Author: Dilawar Singh <dilawar.s.rajput@gmail.com>
8
+ // Organization: NCBS Bangalore
12
9
13
10
#include < map>
14
11
#include < typeindex>
Original file line number Diff line number Diff line change @@ -600,6 +600,7 @@ def le(el=None):
600
600
el = _moose .getCwe () if el is None else el
601
601
if isinstance (el , str ):
602
602
el = _moose .element (el )
603
+ print (el )
603
604
elif isinstance (el , _moose .vec ):
604
605
el = el [0 ]
605
606
return _moose .le (el )
Original file line number Diff line number Diff line change @@ -203,6 +203,17 @@ def test_paths():
203
203
x = moose .Neutral ('///x' )
204
204
assert x .path == '/x' , x .path
205
205
206
+ def test_le ():
207
+ # see issue BhallaLab/moose-core#423
208
+ x = moose .le ('/' )
209
+ assert len (x ) > 5 , x
210
+ try :
211
+ moose .le ('/abrakadabra' )
212
+ except ValueError :
213
+ pass
214
+ else :
215
+ raise RuntimeError ("This should have raised ValueError" )
216
+
206
217
def main ():
207
218
test_paths ()
208
219
test_children ()
@@ -216,6 +227,7 @@ def main():
216
227
test_vec ()
217
228
test_typing ()
218
229
test_elements ()
230
+ test_le ()
219
231
220
232
if __name__ == '__main__' :
221
233
main ()
You can’t perform that action at this time.
0 commit comments