| | 23 | |
| | 24 | def test_subfieldbase_plays_nice_with_module_inspect(self): |
| | 25 | """ |
| | 26 | Custom fields should play nice with python standard module inspect. |
| | 27 | |
| | 28 | http://users.rcn.com/python/download/Descriptor.htm#properties |
| | 29 | """ |
| | 30 | # even when looking for totally different properties, SubfieldBase it's |
| | 31 | # non property like behaviour makes inspect crash. |
| | 32 | strings = inspect.getmembers(MyModel, lambda x: type(x) is str) |
| | 33 | known_strings = [('__doc__', 'MyModel(id, name, data)'), |
| | 34 | ('__module__', 'modeltests.field_subclassing.models')] |
| | 35 | |
| | 36 | self.assertEqual(strings, known_strings) |
| | 37 | |
| | 38 | # should also not raise an exception |
| | 39 | inspect.getmembers(MyModel) |