def props(self, element=None, mode='all', deep=False): # TODO: The mode 'deep' is deprecated in favor of the deep argument # and should be removed in a future version modes = ['all', 'deep', 'models', 'constants'] mode = self._parse_mode(mode=mode, allowed=modes, single=False) prop_list = Tools.PrintableList() if ('deep' in mode) or (deep is True): if mode.count('deep') > 0: mode.remove('deep') for geom in self._geometries: prop_list.extend(geom.props(element=element, mode=mode)) # Get unique values prop_list = Tools.PrintableList(set(prop_list)) prop_list.extend(super().props(element=element, mode=mode)) return prop_list
def test_str(self): list_ = Tools.PrintableList(['first', 'second']) actual_string = list_.__str__() expected_string = \ '------------------------------------------------------------\n' + \ '1\t: first\n' + \ '2\t: second\n' + \ '------------------------------------------------------------' assert actual_string == expected_string
def props(self, element=None, mode='all'): prop_list = [] if 'deep' in mode: mode.remove('deep') for geom in self._geometries: prop_list.extend(geom.props(element=element, mode=mode)) # Get unique values prop_list = Tools.PrintableList(set(prop_list)) prop_list.extend(super().props(element=element, mode=mode)) return prop_list
def test_hidden_items(self): list_ = Tools.PrintableList(['pore.first', 'pore._second']) actual_string = list_.__str__() assert 'pore.first' in actual_string assert 'pore._second' not in actual_string
def setup_class(self): self.list = Tools.PrintableList(['first', 'second'])