Skip to content

Commit

Permalink
And add a test for new classes added without being specified in allow…
Browse files Browse the repository at this point in the history
…ed_attrs
  • Loading branch information
danthedeckie committed Oct 28, 2024
1 parent 8b9364a commit ba1a3ec
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test_simpleeval.py
Original file line number Diff line number Diff line change
Expand Up @@ -1397,6 +1397,15 @@ class Foo:
simple_eval("foo.hidden", names={"foo": Foo()}, allowed_attrs=extended_attrs), 42
)

def test_disallowed_types(self):
class Foo:
bar = 42

assert Foo().bar == 42

with self.assertRaises(FeatureNotAvailable):
simple_eval("foo.bar", names={"foo": Foo()}, allowed_attrs=BASIC_ALLOWED_ATTRS)

def test_breakout_via_generator(self):
# Thanks decorator-factory
class Foo:
Expand Down

0 comments on commit ba1a3ec

Please sign in to comment.