Skip to content

Commit 8c90d67

Browse files
committed
Add test for deletion error, correctly use __delitem__ instead of delete
1 parent f61dd4a commit 8c90d67

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

eip712_structs/struct.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ def __setitem__(self, key, value):
287287

288288
return self.values.__setitem__(key, value)
289289

290-
def __delete__(self, instance):
290+
def __delitem__(self, _):
291291
raise TypeError('Deleting entries from an EIP712Struct is not allowed.')
292292

293293

tests/test_encode_data.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,3 +240,6 @@ class Baz(EIP712Struct):
240240
with pytest.raises(ValueError):
241241
# Expects a Foo type, so should throw an error
242242
bar['f'] = baz
243+
244+
with pytest.raises(TypeError):
245+
del foo['s']

0 commit comments

Comments
 (0)