Best Python code snippet using tappy_python
rules.py
Source:rules.py  
...26        if len(self._lines_seen['plan']) > 1:27            self._add_error('Only one plan line is permitted per file.')28            return29        plan, at_line = self._lines_seen['plan'][0]30        if not self._plan_on_valid_line(at_line, final_line_count):31            self._add_error(32                'A plan must appear at the beginning or end of the file.')33            return34        if plan.expected_tests != self._lines_seen['test']:35            self._add_error('Expected {0} tests but only {1} ran.'.format(36                plan.expected_tests, self._lines_seen['test']))37    def _plan_on_valid_line(self, at_line, final_line_count):38        """Check if a plan is on a valid line."""39        # Put the common cases first.40        if at_line == 1 or at_line == final_line_count:41            return True42        # The plan may only appear on line 2 if the version is at line 1.43        after_version = (44            self._lines_seen['version'] and45            self._lines_seen['version'][0] == 1 and46            at_line == 2)47        if after_version:48            return True49        return False50    def handle_bail(self, bail):51        """Handle a bail line."""...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!!
