-
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 #35 from vreuter/dev
0.9
- Loading branch information
Showing
10 changed files
with
25 additions
and
21 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
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.8" | ||
__version__ = "0.9" |
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 |
---|---|---|
|
@@ -7,14 +7,14 @@ | |
__email__ = "[email protected]" | ||
|
||
|
||
__all__ = ["OrdPathExAttMap"] | ||
__all__ = ["PathExAttMap"] | ||
|
||
|
||
class OrdPathExAttMap(OrdAttMap): | ||
class PathExAttMap(OrdAttMap): | ||
""" Used in pepkit projects, with Mapping conversion and path expansion """ | ||
|
||
@property | ||
def _transformations(self): | ||
""" Add path expansion behavior to more general attmap. """ | ||
return super(OrdPathExAttMap, self)._transformations + \ | ||
return super(PathExAttMap, self)._transformations + \ | ||
[(lambda obj: isinstance(obj, str), expandpath)] |
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
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
import pytest | ||
from hypothesis import given | ||
from hypothesis.strategies import * | ||
from attmap import AttMap, AttMapEcho, OrdAttMap, OrdPathExAttMap | ||
from attmap import AttMap, AttMapEcho, OrdAttMap, PathExAttMap | ||
|
||
__author__ = "Vince Reuter" | ||
__email__ = "[email protected]" | ||
|
@@ -38,15 +38,15 @@ def kv_lists_strategy(pool=(integers, text, characters, uuids), **kwargs): | |
|
||
@pytest.mark.parametrize(["cls", "exp"], [ | ||
(OrdAttMap, True), (OrderedDict, True), (AttMap, True), | ||
(OrdPathExAttMap, False), (AttMapEcho, False)]) | ||
(PathExAttMap, False), (AttMapEcho, False)]) | ||
def test_subclassing(cls, exp): | ||
""" Verify that OrdAttMap type has expected type memberships. """ | ||
assert exp is issubclass(OrdAttMap, cls) | ||
|
||
|
||
@pytest.mark.parametrize(["cls", "exp"], [ | ||
(OrdAttMap, True), (OrderedDict, True), (AttMap, True), | ||
(OrdPathExAttMap, False), (AttMapEcho, False)]) | ||
(PathExAttMap, False), (AttMapEcho, False)]) | ||
def test_type_membership(cls, exp): | ||
""" Verify that an OrdAttMap instance passes type checks as expected. """ | ||
assert exp is isinstance(OrdAttMap(), cls) | ||
|
@@ -115,7 +115,7 @@ def test_ordattmap_deletion(hwy_dat_key, raw_hwy_dat, alter, check): | |
assert check(orig, obs), "Expected {} but found {}".format(orig, obs) | ||
|
||
|
||
@pytest.mark.parametrize("base_type", [OrdAttMap, OrdPathExAttMap]) | ||
@pytest.mark.parametrize("base_type", [OrdAttMap, PathExAttMap]) | ||
@pytest.mark.parametrize( | ||
["that_type", "final_exp"], | ||
[(dict, sys.version_info >= (3, 6)), (OrderedDict, True), (OrdAttMap, True)]) | ||
|
@@ -166,7 +166,7 @@ def _excl_from_repr(self, k, cls): | |
|
||
@pytest.mark.parametrize(["that_type", "exp"], [ | ||
(OrdAttMap, True), (AttMapEcho, False), (AttMap, False), | ||
(OrdPathExAttMap, False), (OrderedDict, False), (dict, False)]) | ||
(PathExAttMap, False), (OrderedDict, False), (dict, False)]) | ||
def test_ordattmap_repr(raw_hwy_dat, that_type, exp): | ||
""" Test __repr__ of OrdAttMap. """ | ||
assert exp is (repr(OrdAttMap(raw_hwy_dat)) == repr(that_type(raw_hwy_dat))) | ||
|
@@ -178,7 +178,7 @@ class BasicDataTests: | |
BASIC_DATA = [("a", OrderedDict([("c", 3), ("b", 2)])), ("d", 4), | ||
("e", OrderedDict([("f", 6)]))] | ||
|
||
@pytest.fixture(params=[OrdAttMap, OrdPathExAttMap]) | ||
@pytest.fixture(params=[OrdAttMap, PathExAttMap]) | ||
def oam(self, request): | ||
""" Provide test case with a simple ordered attmap instance. """ | ||
return request.param(self.BASIC_DATA) | ||
|
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