(self)
| 885 | self.assertEqual(traits, dict(i=A.i, f=A.f, j=A.j)) |
| 886 | |
| 887 | def test_traits_metadata_deprecated(self): |
| 888 | with expected_warnings([r"metadata should be set using the \.tag\(\) method"] * 2): |
| 889 | |
| 890 | class A(HasTraits): |
| 891 | i = Int(config_key="VALUE1", other_thing="VALUE2") |
| 892 | f = Float(config_key="VALUE3", other_thing="VALUE2") |
| 893 | j = Int(0) |
| 894 | |
| 895 | a = A() |
| 896 | self.assertEqual(a.traits(), dict(i=A.i, f=A.f, j=A.j)) |
| 897 | traits = a.traits(config_key="VALUE1", other_thing="VALUE2") |
| 898 | self.assertEqual(traits, dict(i=A.i)) |
| 899 | |
| 900 | # This passes, but it shouldn't because I am replicating a bug in |
| 901 | # traits. |
| 902 | traits = a.traits(config_key=lambda v: True) |
| 903 | self.assertEqual(traits, dict(i=A.i, f=A.f, j=A.j)) |
| 904 | |
| 905 | def test_init(self): |
| 906 | class A(HasTraits): |
nothing calls this directly
no test coverage detected