Core and advanced Python
Topics
Introduction to Python.
Control flow and loops
Data Structures – Lists and Tuples
Data Structures – Sets and Dictionaries
User defined functions
Iterators and Generators
Object-Oriented Programming (OOP)
Advanced OOP Concepts
Modules and packages (pattern matching)
Modules and packages(Cont…)
File Handling
Exceptinon handling
Flask
Unit Testing & Pytest
Automation testing
CI Testing
code coverage/format/pattern/doc
Threading and processing
Subtopics
• Introduction to Python.
• Key features: High-level, interpreted, dynamically typed, object-oriented.
• Diverse applications: Data science, web development, automation, scripting, etc.
• Installing Python:
Choosing and configuring an IDE like VS Code, PyCharm, or Jupyter Notebook.
Understanding and using virtual environments (e.g., `venv`) to isolate project dependencies.
• Basic syntax: Indentation, comments, variables, and data types (integers, floats, numbers, booleans).
• Operators: Arithmetic, comparison, logical, bitwise.
• Strings: slicing, reversing, indexing, Accessing a Docstring, raw string, string formatting
• Control flow: `if`, `elif`, `else` for making decisions in code.
• Looping constructs:
`for` loop execution in min. 10 different ways (with range, in, enumerate, with container types, decrementing, else).
`while` loop for indefinite iterations.
Understanding and using `break`, `continue`, and `pass` statements to control loop execution.
• Nested loops: Handling multiple levels of iteration.
• Lists: Ordered, mutable collections of elements.
• Creating lists in 5 different ways, accessing elements (indexing, slicing).
• List methods: `append()`, `insert()`, `remove()`, `pop()`, `sort()`, `reverse()`.
• List comprehensions: Concise way to create lists.
• Tuples: Ordered, immutable collections of elements.
• Unpacking tuples, accessing elements.
• List VS tuple
• Dictionaries: Key-value pairs for efficient data lookup.
• Creating dictionaries, accessing values, adding/updating key-value pairs.
• Dictionary methods: `keys()`, `values()`, `items()`.
• Dictionary comprehensions.
• Sets: Unordered collections of unique elements.
• Set operations: `union()`, `intersection()`, `difference()`, frozen set.
• Set comprehensions.
• Declaring, defining and calling functions to encapsulate reusable blocks of code.
• Function arguments: Positional arguments, keyword arguments, default arguments.
• Return values: Returning results from functions.
• Scope of variables: Local, global, and nonlocal variables.
• Lambda functions: Creating concise anonymous functions.
• Higher-order functions: Functions that accept other functions as arguments or return functions as results.
• Recursive functions: with recursive limits
• Iterables and iterators: Understanding the `iter()` and `next()` functions.
• Creating custom iterators.
• Generators: Functions that produce a sequence of values using the `yield` keyword.
• Lazy evaluation and memory efficiency.
• Decorators
• Decorators: Functions that modify the behavior of other functions.
• Creating and using decorators.
• Classes, objects, attributes, and methods.
• Creating classes and instantiating objects.
• Accessing attributes and calling methods.
• The `__init__` method (constructor) for object initialization.
• Class variables vs. instance variables, self-parameter.
• Inheritance: Multiple and multi-level inheritance.
• Method overriding, over loading and polymorphism.
• Abstract base classes and methods(ABCs) for defining interfaces.
• Static and class methods.
• Duck typing, inherit __init__()
• Access specifiers and why not to use them
• Set and get attributes
• Built-in modules:
• ‘re’: pattern match by match, search, findall, finditer, subn, compile & fullmatch functions, check for the correct mail id
• `os`: change the current path, know the functions modules being used, create and delete directories and more.
• `sys`:how it works with back end memory management, path changing, printing messages and errors etc.
• `math`: floor, ceil, factorial, gcd, lcm etc.
• `random`:random, randint, random choices
• `datetime`, `calendar’: datetime data type, str and different ways to take and print date and time, text and HTML calend
• Importing modules: `import`, `from ... import`.
• Create a module: __name__ and __main__()
• Creating and organizing code into packages.
• The `__init__.py` file and its significance.
• Working with files: Opening and closing files using `open()`function.
• Reading data from files: `read()`, `readline()`, `readlines()`.
• Writing data to files: `write()`, `writelines()`.
• Using `with` statement for context management (automatic file closing).
• Handling different file modes (read, write, append, binary).
• Reversing the content of file, dumping as Json file, zipping, copying and deleting the files.
• Blocks: try, except, else and finally
• Multiple exceptions
• General and specific error handling
raising an error
• Defining and raising an error
• code coverage/format/pattern (e.g pylint,isort,pytest-cov) python documents format (e.g.pydoc)
Pylint(/Flake8/mypy/Prospector/Pysa), Pydoc(Sphix/Pydoctor/pdoc) etc.
• Project allocation
• Creating your first Flask app
• Routing in Flask
• Dynamic routing and URL variables
• Core Concepts: HTTP Methods in Flask
• Handling GET and POST requests
• Using request and response objects
• Templates in Flask Rendering HTML templates
• Introduction to Unit Testing
• Designing Test Cases
• Writing effective test cases
• Test case structure: Arrange, Act, Assert
• Mocking and Stubbing:
Introduction to mocking
Using mock objects in tests
• Testing Best Practices:
Isolating test cases
Naming conventions for test methods
• Introduction to Pytest: Installation and setup
• Writing Tests in Pytest
Test function structure
Naming conventions
• Fixtures in Pytest:
Reusable setup and teardown logic
Parameterizing fixtures
• Assertions in Pytest:
Using assert statements effectively
Custom error messages
Parameterized Testing: Running tests with multiple inputs
• Markers and Tags:
Organizing and filtering tests
Built-in and custom markers
• Mocking in Pytest: Using pytest-mock or unittest.mock
• Introduction to Tox:
What is Tox and its role in automation testing
Installation and setup
• Tox Configuration:
Understanding tox.ini file
Specifying environments and dependencies
• Running Tests Across Environments
Testing on multiple Python versions
Configuring virtual environments
Testing on multiple Python versions
Configuring virtual environments
Test Automation:
Unit Testing
Integration Testing
End-to-End Testing
API Testing
UI Testing
Testing Frameworks:
Unittest (Python)
Pytest (Python)
Test Coverage Analysis:
Measuring code coverage to identify untested areas.
CI/CD Tools & Pipelines:
Jenkins
Automating Tox in CI/CD pipelines
Using Tox with Jenkins/GitHub Actions
• Custom Commands in Tox
Writing and executing custom commands
Pre- and post-test hooks
Test Reporting:
Generating and analyzing test reports (JUnit XML, Allure Reports)
• Code Coverage/format/pattern (e.g pylint,isort,pytest-cov) python documents format (e.g.pydoc)
Pylint(/Flake8/mypy/Prospector/Pysa), Pydoc(Sphix/Pydoctor/pdoc) etc .)
• Code Formatting Tools: YAPF, Autopep8, Black
Ensure consistent code style and formatting.
Automatically format Python code to adhere to PEP 8 standards.
Differences in strictness and style (e.g., Black enforces opinionated formatting).
• Code Linting Tools: Pylint, Flake8, Prospector
Analyze code for errors, style issues, and adherence to standards.
Offer suggestions to improve code quality.
Support plugin-based customization.
• Type Checking Tools: Mypy
Perform static type checking for Python code using type annotations.
Ensure type correctness during development.
• Security Analysis Tools: Pysa
Static analysis tool for identifying security vulnerabilities.
Specialized for taint analysis in Python code.
• Documentation Generation Tools: Pydoc, Sphinx, Pydoctor, pdoc
Generate API documentation from code and docstrings.
Support HTML, PDF, and other formats for documentation.
Enable interactive and detailed documentation for projects.
• Code Quality Aggregators: Prospector
Combine results from multiple linters and formatters into a single report.
Provide an overall score for code quality.
• Multi-Threading: start, stop, sleep
• Creating and starting processes
• Using Process class
• sub processing
• Using multiprocessing.Pool