Skip to content

Commit

Permalink
Unit tests for deletion of property traits.
Browse files Browse the repository at this point in the history
  • Loading branch information
Joris Vankerschaver committed Feb 13, 2014
1 parent f03091f commit cfcf87a
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions traits/tests/test_property_delete.py
@@ -0,0 +1,31 @@
"""
Unit tests to ensure that we can call reset_traits/delete on a
property trait (regression tests for Github issue #67).
"""

from traits import _py2to3
from traits.api import Any, HasTraits, Int, Property, TraitError
from traits.testing.unittest_tools import unittest


class E(HasTraits):

a = Property(Any)

b = Property(Int)


class TestPropertyDelete(unittest.TestCase):

def test_property_delete(self):
e = E()
with self.assertRaises(TraitError):
del e.a
with self.assertRaises(TraitError):
del e.b

def test_property_reset_traits(self):
e = E()
unresetable = e.reset_traits()
_py2to3.assertCountEqual(self, unresetable, ['a', 'b'])

0 comments on commit cfcf87a

Please sign in to comment.