コード例 #1
0
ファイル: test_fromdict.py プロジェクト: Myconomy/dictalchemy
 def test_dictalchemy_include(self):
     m = WithHybrid(2)
     m.fromdict({'value': 7})
     assert m.value == 2
     setattr(m, 'dictalchemy_include', ['value'])
     m.fromdict({'value': 7})
     assert m.value == 7
コード例 #2
0
ファイル: test_fromdict.py プロジェクト: atchai/dictalchemy
 def test_dictalchemy_include(self):
     m = WithHybrid(2)
     m.fromdict({'id': 7})
     assert m.id == 2
     setattr(m, 'dictalchemy_include', ['id'])
     m.fromdict({'id': 7})
     assert m.id == 7
コード例 #3
0
 def test_dictalchemy_asdict_include_overrides(self):
     m = WithHybrid(2)
     assert 'value' not in dict(m)
     setattr(m, 'dictalchemy_include', ['value'])
     assert 'value' in dict(m)
     setattr(m, 'dictalchemy_asdict_include', [])
     assert 'value' not in dict(m)
コード例 #4
0
 def test_dictalchemy_asdict_include_overrides(self):
     m = WithHybrid(2)
     m.fromdict({'value': 7})
     assert m.value == 2
     setattr(m, 'dictalchemy_include', ['value'])
     m.fromdict({'value': 7})
     setattr(m, 'dictalchemy_fromdict_include', [])
     m.fromdict({'value': 2})
     assert m.value == 7
コード例 #5
0
ファイル: test_fromdict.py プロジェクト: Myconomy/dictalchemy
 def test_dictalchemy_asdict_include_overrides(self):
     m = WithHybrid(2)
     m.fromdict({'value': 7})
     assert m.value == 2
     setattr(m, 'dictalchemy_include', ['value'])
     m.fromdict({'value': 7})
     setattr(m, 'dictalchemy_fromdict_include', [])
     m.fromdict({'value': 2})
     assert m.value == 7
コード例 #6
0
 def test_dictalchemy_include(self):
     m = WithHybrid(2)
     m.fromdict({'value': 7})
     assert m.value == 2
     setattr(m, 'dictalchemy_include', ['value'])
     m.fromdict({'value': 7})
     assert m.value == 7
コード例 #7
0
 def test_dictalchemy_include(self):
     m = WithHybrid(2)
     m.fromdict({'id': 7})
     assert m.id == 2
     setattr(m, 'dictalchemy_include', ['id'])
     m.fromdict({'id': 7})
     assert m.id == 7
コード例 #8
0
 def test_include(self):
     h = WithHybrid(1)
     h.fromdict({'value': 17}, include=['value'])
     assert h.value == 17
コード例 #9
0
 def test_hybrid_property(self):
     assert WithHybrid(2).asdict(include=['value'])['value'] == 2
コード例 #10
0
ファイル: test_asdict.py プロジェクト: davidkhess/dictalchemy
 def test_dictalchemy_include(self):
     m = WithHybrid(2)
     assert 'id' not in dict(m)
     setattr(m, 'dictalchemy_include', ['id'])
     assert 'id' in dict(m)
コード例 #11
0
ファイル: test_asdict.py プロジェクト: davidkhess/dictalchemy
 def test_hybrid_property(self):
     assert WithHybrid(2).asdict(include=['id']) == {'id': 2}
コード例 #12
0
ファイル: test_fromdict.py プロジェクト: Myconomy/dictalchemy
 def test_include(self):
     h = WithHybrid(1)
     h.fromdict({'value': 17}, include=['value'])
     assert h.value == 17
コード例 #13
0
ファイル: test_fromdict.py プロジェクト: atchai/dictalchemy
 def test_include(self):
     h = WithHybrid(1)
     h.fromdict({'id': 17}, include=['id'])
     assert h.id == 17
コード例 #14
0
 def test_include(self):
     h = WithHybrid(1)
     h.fromdict({'id': 17}, include=['id'])
     assert h.id == 17