Add ability to import modules with dashes or spaces
Any module with underscores in it will now attempt to look for 3 files, first the original, then with dashes, then with spaces, ie: import addressbook_v_2_capnp will search for 'addressbook_v_2.capnp', 'addressbook-v-2.capnp', and 'addressbook v 2.capnp'.
This commit is contained in:
@@ -58,6 +58,12 @@ def test_failed_import():
|
||||
def test_defualt_import_hook():
|
||||
import addressbook_capnp
|
||||
|
||||
def test_dash_import():
|
||||
import addressbook_with_dashes_capnp
|
||||
|
||||
def test_spaces_import():
|
||||
import addressbook_with_spaces_capnp
|
||||
|
||||
def test_add_import_hook():
|
||||
capnp.add_import_hook([this_dir])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user