Test Engineering Notes
Україномовний канал про технічні аспекти тестування, розподілені системи, блокчейн та кібербезпеку.
Больше- Подписчики
- Просмотры постов
- ER - коэффициент вовлеченности
Загрузка данных...
Загрузка данных...
When Simple Mail Transfer Protocol is not simple
sys.maxsize
import sys
a = 100500
print(f"a = {a} та має тип {type(a)}")
print(f"максимальний розмір типу int: {sys.maxsize}")
Замість окремих float / double - Python має тільки float.
b = 123.456
print(f"b = {b} та має тип {type(b)}")
Крім float, є можливість працювати комплексними числами, а також з decimal / fraction.
c = 100 + 5j
print(f"c = {c} та має тип {type(c)}")
from decimal import Decimal
from fractions import Fraction
dec = Decimal("0.1")
print(f"dec = {dec} та має тип {type(dec)}")
frac = Fraction(1, 3)
print(f"frac = {frac} та має тип {type(frac)}")
Float дозволяє отримати трохи більш цікаві дані - такі як NaN чи нескінченність.
nan = float("nan")
print(f"nan = {nan} та має тип {type(nan)}")
inf = float("inf")
neg_inf = float("-inf")
print(f"inf = {inf} та має тип {type(inf)}")
print(f"neg_inf = {neg_inf} та має тип {type(neg_inf)}")
Якщо не подобається float, можна застосувати math. Результат той же.
import math
print(f"Те ж саме з math.inf - {math.inf == inf}")
Строки в Python бувають трьох типів - звичайні, сирі (raw) та форматовані.
single_quote_string = 'Hello, World!'
double_quote_string = "Hello, World!"
print(f"Python дозволяє строки з будь-якими лапками: {single_quote_string == double_quote_string}")
raw_string = r"\tRaw \n string"
well_done_string = "\tWell-done \n string"
print(f"raw_string = {raw_string}")
print(f"well_done_string = {well_done_string}")
formatted = f"{a} + {b} = {a + b}"
print(f"formatted = {formatted}")
print(f"formatted з фігурними дужками = {{{formatted}}}")
Результат в консолі:
a = 100500 та має тип <class 'int'>
максимальний розмір типу int: 9223372036854775807
b = 123.456 та має тип <class 'float'>
c = (100+5j) та має тип <class 'complex'>
dec = 0.1 та має тип <class 'decimal.Decimal'>
frac = 1/3 та має тип <class 'fractions.Fraction'>
nan = nan та має тип <class 'float'>
inf = inf та має тип <class 'float'>
neg_inf = -inf та має тип <class 'float'>
Те ж саме з math.inf - True
Python дозволяє строки з будь-якими лапками: True
raw_string = \tRaw \n string
well_done_string = Well-done
string
formatted = 100500 + 123.456 = 100623.456
formatted з фігурними дужками = {100500 + 123.456 = 100623.456}
In this blog, we go on an interactive journey to understand common queueing strategies for handling HTTP requests.
employees = {'Alice': 100000, 'Bob': 99817, 'Carol': 122908, 'Frank': 88123, 'Eve': 93121}
Рішення буде наприклад таким:
top_earners = []
for key, val in employees.items():
if val >= 100000:
top_earners.append((key,val))
print(top_earners)
Але існує трохи більш елегантне рішення, що показує можливості мови Python:
```
top_earners = [(k, v) for k, v in employees.items() if v >= 100000]
print(top_earners)
```
Або навіть:
top_earners = list(filter(lambda x: x[1] >= 100000, employees.items()))
print(top_earners)
Як бачите, на кожну проблему може бути декілька варіантів рішень. Але не забувайте PEP20 - "There should be one-- and preferably only one --obvious way to do it."
А як буде виглядати рішення на вашій улюбленій мові програмування?Curated list of project-based tutorials. Contribute to practical-tutorials/project-based-learning development by creating an account on GitHub.
Everybody hates it when they go to an interview and they are given live coding challenge that is written intentionally to make you fail, so the interviewer can prove his "superiority". Here are 12 playwright interview questions and answers, so you can have the advantage this time.
Ever heard of SQLAlchemy and thought it sounded like a medieval potion? Well, it's not! 🧙♂️🔮 SQLAlchemy combines the robustness of SQL with Python's flexibility, making database management not just easier, but kinda fun too! In this video, I’ll take a closer look at this awesome tool. Try out Oso for free here:
https://oso.1stcollab.com/arjancodes_3🔥 GitHub Repository:
https://git.arjan.codes/2024/sqlalchemy💻 ArjanCodes Blog:
https://www.arjancodes.com/blog✍🏻 Take a quiz on this topic:
https://www.learntail.com/quiz/zewcrdTry Learntail for FREE ➡️
https://www.learntail.com/🎓 Courses: The Software Designer Mindset:
https://www.arjancodes.com/mindsetThe Software Architect Mindset: Pre-register now!
https://www.arjancodes.com/architectNext Level Python: Become a Python Expert:
https://www.arjancodes.com/next-level-pythonThe 30-Day Design Challenge:
https://www.arjancodes.com/30ddc🛒 GEAR & RECOMMENDED BOOKS:
https://kit.co/arjancodes.👍 If you enjoyed this content, give this video a like. If you want to watch more of my upcoming videos, consider subscribing to my channel! Social channels: 💬 Discord:
https://discord.arjan.codes🐦Twitter:
https://twitter.com/arjancodes🌍LinkedIn:
https://www.linkedin.com/company/arjancodes🕵Facebook:
https://www.facebook.com/arjancodes📱Instagram:
https://www.instagram.com/arjancodes♪ Tiktok:
https://www.tiktok.com/@arjancodes👀 Code reviewers: - Yoriz - Ryan Laursen - Dale Hagglund - Kit Hygh - Alexander Milden - Bean 🎥 Video edited by Mark Bacskai:
https://www.instagram.com/bacskaimark🔖 Chapters: 0:00 Intro 1:30 Functional Approach 5:04 Object-Oriented Approach 8:35 Relationships 10:26 Oso 12:18 Relationships part 2 16:02 Outro #arjancodes #softwaredesign #python DISCLAIMER - The links in this description might be affiliate links. If you purchase a product or service through one of those links, I may receive a small commission. There is no additional charge to you. Thanks for supporting my channel so I can continue to provide you with free content each week!
Pytest plugin to generate test report in Common Test Report Format (JSON) - infopulse/pytest-common-test-report-json