forked from bitprophet/lexicon
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fefe489
commit 96d556c
Showing
2 changed files
with
42 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from spec import Spec, eq_ | ||
|
||
from lexicon import Lexicon | ||
|
||
|
||
class Lexicon_(Spec): | ||
def attributes_work(self): | ||
l = Lexicon() | ||
l.foo = 'bar' | ||
eq_(l['foo'], l.foo) | ||
|
||
def aliases_work(self): | ||
l = Lexicon() | ||
l.alias('foo', to='bar') | ||
l['bar'] = 'value' | ||
assert l['foo'] == l['bar'] == 'value' | ||
|
||
def aliases_appear_in_attributes(self): | ||
l = Lexicon() | ||
l.alias('foo', to='bar') | ||
l.foo = 'value' | ||
assert l.foo == l.bar == l['foo'] == l['bar'] == 'value' | ||
|
||
def aliased_real_attributes_do_not_override_real_attributes(self): | ||
l = Lexicon() | ||
l.alias('get', to='notget') | ||
l.notget = 'value' | ||
assert callable(l.get) | ||
assert l.get != 'value' |