def __on_feature_added(self): index = self.__feature_combo.currentIndex() if index > 0: self.__insert_into_expression(sanitized_name(self._feature.name)) self.__feature_combo.setCurrentIndex(0) self.settings_changed()
def __on_parameter_added(self): index = self.__parameter_combo.currentIndex() if index > 0: self.__insert_into_expression(sanitized_name(self._parameter)) self.__parameter_combo.setCurrentIndex(0) self.settings_changed()
def test_sanitized_name(self): self.assertEqual(sanitized_name("Foo"), "Foo") self.assertEqual(sanitized_name("Foo Bar"), "Foo_Bar") self.assertEqual(sanitized_name("0Foo"), "_0Foo") self.assertEqual(sanitized_name("1 Foo Bar"), "_1_Foo_Bar")