Skip to content

Commit

Permalink
Merge pull request #88 from tekknolagi/main
Browse files Browse the repository at this point in the history
Add test for keys not in __dict__
  • Loading branch information
noahmorrison committed Jan 2, 2021
2 parents 6959ae7 + 64c5691 commit a0488ce
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,22 @@ def test_namedtuple_data(self):

self.assertEqual(result, expected)

def test_get_key_not_in_dunder_dict_returns_attribute(self):
class C:
foo = "bar"

instance = C()
self.assertTrue("foo" not in instance.__dict__)

args = {
'template': '{{foo}}',
'data': instance
}
result = chevron.render(**args)
expected = 'bar'

self.assertEqual(result, expected)


# Run unit tests from command line
if __name__ == "__main__":
Expand Down

0 comments on commit a0488ce

Please sign in to comment.