This repository was archived by the owner on Nov 3, 2022. It is now read-only.
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)
550550{
551551 vector<Id> children;
552552 vector<string> chPaths;
553+
554+ if (obj.bad ())
555+ throw pybind11::value_error (" no such element." );
556+
553557 Neutral::children (obj.eref (), children);
554558 stringstream ss;
555559 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.
23//
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.
76//
8- // Author: Dilawar Singh <[email protected] >9- // Organization: NCBS Bangalore
10- //
11- // =====================================================================================
7+ // Author: Dilawar Singh <[email protected] >8+ // Organization: NCBS Bangalore
129
1310#include < map>
1411#include < typeindex>
Original file line number Diff line number Diff line change @@ -600,6 +600,7 @@ def le(el=None):
600600 el = _moose .getCwe () if el is None else el
601601 if isinstance (el , str ):
602602 el = _moose .element (el )
603+ print (el )
603604 elif isinstance (el , _moose .vec ):
604605 el = el [0 ]
605606 return _moose .le (el )
Original file line number Diff line number Diff line change @@ -203,6 +203,17 @@ def test_paths():
203203 x = moose .Neutral ('///x' )
204204 assert x .path == '/x' , x .path
205205
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+
206217def main ():
207218 test_paths ()
208219 test_children ()
@@ -216,6 +227,7 @@ def main():
216227 test_vec ()
217228 test_typing ()
218229 test_elements ()
230+ test_le ()
219231
220232if __name__ == '__main__' :
221233 main ()
You can’t perform that action at this time.
0 commit comments