Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unit tests for deletion of property traits.
- Loading branch information
Joris Vankerschaver
committed
Feb 13, 2014
1 parent
f03091f
commit cfcf87a
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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']) |