Best Python code snippet using autotest_python
kernel_config_unittest.py
Source:kernel_config_unittest.py  
...100            prefix="autotest_kernel_config_unittest")101        self.config_modules = open(self.config_modules_path, "w")102        self.config_modules.write(CONFIG_SAMPLE)103        self.config_modules.close()104    def testFeatureEnabled(self):105        for feature in ['CONFIG_SLABINFO', 'CONFIG_RT_MUTEXES',106                        'CONFIG_HIBERNATION']:107            self.assertEqual(kernel_config.feature_enabled(feature,108                                                           self.config_modules_path), True)109    def testFeatureDisabled(self):110        for feature in ['CONFIG_MODULE_SIG_SHA512', 'CONFIG_PM_TEST_SUSPEND']:111            self.assertEqual(kernel_config.feature_enabled(feature,112                                                           self.config_modules_path), False)113    def testFeatureDisabledByUser(self):114        self.assertEqual(kernel_config.feature_enabled("CONFIG_NASTY_USER",115                                                       self.config_modules_path), False)116    def testModulesNeeded(self):117        self.assertEqual(kernel_config.modules_needed(118            self.config_modules_path), True)...test_account_feature.py
Source:test_account_feature.py  
1from athenian.api.db import Database2from athenian.api.internal.account_feature import is_feature_enabled3from tests.testutils.db import models_insert4from tests.testutils.factory.state import AccountFeatureFactory, FeatureFactory5class TestFeatureEnabled:6    async def test_not_existing(self, sdb: Database) -> None:7        assert not await is_feature_enabled(1, "FT", sdb)8    async def test_default_enabled(self, sdb: Database) -> None:9        await models_insert(10            sdb,11            FeatureFactory(name="FT0", id=100, enabled=True),12            AccountFeatureFactory(account_id=1, feature_id=100, enabled=False),13            AccountFeatureFactory(account_id=2, feature_id=100, enabled=True),14        )15        for account_id, expected in ((1, False), (2, True), (3, True)):16            assert (await is_feature_enabled(account_id, "FT0", sdb)) is expected17    async def test_default_disabled(self, sdb: Database) -> None:18        await models_insert(19            sdb,20            FeatureFactory(name="FT0", id=100, enabled=False),21            AccountFeatureFactory(account_id=1, feature_id=100, enabled=False),22            AccountFeatureFactory(account_id=2, feature_id=100, enabled=True),23        )24        for account_id, expected in ((1, False), (2, True), (3, False)):...Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!
