Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(7)  |  Call(7)  |  Derive(0)  |  Import(0)

src/a/z/AZOrange-HEAD/orange/OrangeWidgets/Data/OWRenameClass.py   AZOrange(Download)
        self.info.setText("Actual class name: " + self.data.domain.classVar.name)
 
        newData = dataUtilities.changeClassName(self.data , self.newName)
        if not newData or not newData.domain.classVar:
            self.error(0,'It was not possible to rename the class variable. Invalid data or name.')

src/a/z/AZOrange-HEAD/tests/source/AZdataUtilitiesTest.py   AZOrange(Download)
    def test_changeClassName(self):
        """Test the changeClassName method"""
        self.assertEqual(self.testData.domain.classVar.name,"Activity")
        newData = dataUtilities.changeClassName(self.testData,"NewClassName")
 
 
        #Change the class name to an existing name in attributes
        newData = dataUtilities.changeClassName(self.testData,"Level")
        self.assertEqual(newData.domain.classVar.name,"Level_1")
 
        # the class name will not be tested for name duplication
        newData = dataUtilities.changeClassName(newData,"Level")
        self.assertEqual(newData.domain.classVar.name,"Level_1")
        newData = dataUtilities.changeClassName(self.testData,"Activity")
 
        # If something is missing, None will be returned
        newData = dataUtilities.changeClassName(None,"NAME")
        self.assertEqual(newData,None)
        newData = dataUtilities.changeClassName(self.testData,"")