-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #60 from pepkit/dev
0.12.5
- Loading branch information
Showing
12 changed files
with
91 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -71,5 +71,6 @@ Thumbs.db | |
# Build-related stuff | ||
build/ | ||
dist/ | ||
site/ | ||
attmap.egg-info/ | ||
docs/autodoc_build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
__version__ = "0.12.4" | ||
__version__ = "0.12.5" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Attmap class inheritance hierarchy | ||
|
||
Attmap is organized into a series of related objects with slightly different behavior. This document shows the class relationships. Classes underneath others in this tree indicate parent-child relationships of the classes. | ||
|
||
- [`AttMapLike`](autodoc_build/attmap.md#AttMapLike) (abstract) | ||
- [`AttMap`](autodoc_build/attmap.md#AttMap) | ||
- [`OrdAttMap`](autodoc_build/attmap.md#OrdAttMap) | ||
- [`PathExAttMap`](autodoc_build/attmap.md#PathExAttMap) | ||
- [`EchoAttMap`](autodoc_build/attmap.md#EchoAttMap) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
""" Tests for path expansion behavior """ | ||
|
||
import copy | ||
import itertools | ||
import os | ||
import random | ||
|
@@ -8,6 +9,7 @@ | |
from attmap import * | ||
from ubiquerg import expandpath, TmpEnv | ||
|
||
|
||
__author__ = "Vince Reuter" | ||
__email__ = "[email protected]" | ||
|
||
|
@@ -115,6 +117,32 @@ def test_non_PathExAttMap_preserves_all_variables(path, fetch, env): | |
("http://lh/$HOME/page.html", "http://lh/{}/page.html".format(os.environ["HOME"]))]) | ||
@pytest.mark.parametrize("fetch", [lambda m, k: m[k], lambda m, k: getattr(m, k)]) | ||
def test_url_expansion(path, expected, fetch): | ||
""" URL expansion considers env vars but doesn't ruin slashes. """ | ||
key = "arbitrary" | ||
m = PathExAttMap({key: path}) | ||
assert expected == fetch(m, key) | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"varname", ["THIS_SHOULD_NOT_BE_SET", "REALLY_IMPROBABLE_ENV_VAR"]) | ||
@pytest.mark.parametrize(["var_idx", "path_parts"], itertools.chain(*[ | ||
[(i, list(p)) for p in itertools.permutations(c) for i in range(k + 1)] | ||
for k in range(0, 4) for c in itertools.combinations(["a", "b", "c"], k)])) | ||
@pytest.mark.parametrize("store", [setattr, lambda m, k, v: m.__setitem__(k, v)]) | ||
@pytest.mark.parametrize("fetch", [getattr, lambda m, k: m[k], lambda m, k: m.get(k)]) | ||
def test_multiple_syntax_path_expansion(varname, path_parts, var_idx, tmpdir, store, fetch): | ||
""" Test the different combinations of setting and retrieving an env var path. """ | ||
key = "arbitrary" | ||
parts = copy.copy(path_parts) | ||
env_var = "$" + varname | ||
env_var_val = "set-via-env-var" | ||
parts.insert(var_idx, env_var) | ||
final_parts = [tmpdir.strpath] + parts | ||
print("FINAL PARTS: {}".format(final_parts)) | ||
path = os.path.join(*final_parts) | ||
m = PathExAttMap() | ||
store(m, key, path) | ||
with TmpEnv(**{varname: env_var_val}): | ||
assert env_var_val == os.getenv(varname) | ||
assert path != expandpath(path) | ||
assert expandpath(path) == fetch(m, key) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
__email__ = "[email protected]" | ||
|
||
|
||
@pytest.mark.para | ||
@pytest.mark.parametrize("entries", [ | ||
{}, {"a": 1}, {"b": {"c": 3}}, {"A": [1, 2]}, | ||
{"B": 1, "C": np.arange(3)}, {"E": Series(["a", "b"])}]) | ||
|