
GITHUB . COM {
}
Detected CMS Systems:
- Wordpress (2 occurrences)
Title:
pytest.approx considers boolean numeric types Β· Issue #9353 Β· pytest-dev/pytest
Description:
From the docs: You can also use approx to compare nonnumeric types, or dicts and sequences containing nonnumeric types, in which case it falls back to strict equality. This can be useful for comparing dicts and sequences that can contain...
Website Age:
17 years and 8 months (reg. 2007-10-09).
Matching Content Categories {π}
- Technology & Computing
- Law & Government
- News & Politics
Content Management System {π}
What CMS is github.com built with?
Github.com employs WORDPRESS.
Traffic Estimate {π}
What is the average monthly size of github.com audience?
ππ Tremendous Traffic: 10M - 20M visitors per month
Based on our best estimate, this website will receive around 10,000,019 visitors per month in the current month.
However, some sources were not loaded, we suggest to reload the page to get complete results.
check SE Ranking
check Ahrefs
check Similarweb
check Ubersuggest
check Semrush
How Does Github.com Make Money? {πΈ}
Subscription Packages {π³}
We've located a dedicated page on github.com that might include details about subscription plans or recurring payments. We identified it based on the word pricing in one of its internal links. Below, you'll find additional estimates for its monthly recurring revenues.How Much Does Github.com Make? {π°}
Subscription Packages {π³}
Prices on github.com are in US Dollars ($).
They range from $4.00/month to $21.00/month.
We estimate that the site has approximately 4,989,889 paying customers.
The estimated monthly recurring revenue (MRR) is $20,957,532.
The estimated annual recurring revenues (ARR) are $251,490,385.
Wordpress Themes and Plugins {π¨}
What WordPress theme does this site use?
It is strange but we were not able to detect any theme on the page.
What WordPress plugins does this website use?
It is strange but we were not able to detect any plugins on the page.
Keywords {π}
approx, issue, bool, pytest, comparison, types, added, exact, true, jvansanten, commit, references, sign, pytestapprox, false, active, mentioned, projects, boolean, closed, equality, optional, values, nicoddemus, dougburke, navigation, pull, requests, actions, security, considers, numeric, thecompiler, docs, nonnumeric, dicts, sequences, back, comparing, approxnone, booleans, assert, technically, correct, topic, related, function, approximate, allowed, completedin,
Topics {βοΈ}
f119657 jvansanten mentioned 0fafdd4 dougburke mentioned personal information pytest 15e165e patchback mentioned compare nonnumeric types approx function type comment metadata assignees assigned labels topic type projects boolean values projects milestone nonnumeric types handle pytest 8 target types arithmetic types docs compiler opened approx related falls back treat booleans numerical values technically correct comparing booleans approximate comparison falling back enum-enum straightforward solution approximate comparisons exact comparison tests fail milestone relationships == pytest pytest 6 pytest pytest 8 strict equality expected-obtained equality fallback true == approx comparing dicts special-case github issue optional values assert {'active' int-bool bool tests approx } == approx 0000005] == approx
Payment Methods {π}
- Braintree
Questions {β}
- Already have an account?
Schema {πΊοΈ}
DiscussionForumPosting:
context:https://schema.org
headline:pytest.approx considers boolean numeric types
articleBody:From [the docs](https://docs.pytest.org/en/6.2.x/reference.html#pytest-approx):
> You can also use `approx` to compare nonnumeric types, or dicts and sequences containing nonnumeric types, in which case it falls back to strict equality. This can be useful for comparing dicts and sequences that can contain optional values:
>
> ```python
> >>> {"required": 1.0000005, "optional": None} == approx({"required": 1, "optional": None})
> True
> >>> [None, 1.0000005] == approx([None,1])
> True
> >>> ["foo", 1.0000005] == approx([None,1])
> False
> ```
However, that seems to treat booleans as numerical values too:
```python
import pytest
def test_approx():
d = {"value": 0.3, "active": True}
expected = {"value": 0.1 + 0.2, "active": False}
assert d == pytest.approx(expected)
```
results in:
```python
AssertionError: assert {'active': True, 'value': 0.3} == approx({'value': 0.30000000000000004 Β± 3.0e-07, 'active': False Β± 1.0e-12})
```
(on Python 3.9.7 and pytest 6.2.5). Note the `False Β± 1.0e-12`. While this is *technically* correct, it doesn't seem like a very reasonable way of comparing booleans.
cc @jvansanten who seems to have implemented this originally in #7710.
author:
url:https://github.com/The-Compiler
type:Person
name:The-Compiler
datePublished:2021-11-30T08:41:32.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:1
url:https://github.com/9353/pytest/issues/9353
context:https://schema.org
headline:pytest.approx considers boolean numeric types
articleBody:From [the docs](https://docs.pytest.org/en/6.2.x/reference.html#pytest-approx):
> You can also use `approx` to compare nonnumeric types, or dicts and sequences containing nonnumeric types, in which case it falls back to strict equality. This can be useful for comparing dicts and sequences that can contain optional values:
>
> ```python
> >>> {"required": 1.0000005, "optional": None} == approx({"required": 1, "optional": None})
> True
> >>> [None, 1.0000005] == approx([None,1])
> True
> >>> ["foo", 1.0000005] == approx([None,1])
> False
> ```
However, that seems to treat booleans as numerical values too:
```python
import pytest
def test_approx():
d = {"value": 0.3, "active": True}
expected = {"value": 0.1 + 0.2, "active": False}
assert d == pytest.approx(expected)
```
results in:
```python
AssertionError: assert {'active': True, 'value': 0.3} == approx({'value': 0.30000000000000004 Β± 3.0e-07, 'active': False Β± 1.0e-12})
```
(on Python 3.9.7 and pytest 6.2.5). Note the `False Β± 1.0e-12`. While this is *technically* correct, it doesn't seem like a very reasonable way of comparing booleans.
cc @jvansanten who seems to have implemented this originally in #7710.
author:
url:https://github.com/The-Compiler
type:Person
name:The-Compiler
datePublished:2021-11-30T08:41:32.000Z
interactionStatistic:
type:InteractionCounter
interactionType:https://schema.org/CommentAction
userInteractionCount:1
url:https://github.com/9353/pytest/issues/9353
Person:
url:https://github.com/The-Compiler
name:The-Compiler
url:https://github.com/The-Compiler
name:The-Compiler
InteractionCounter:
interactionType:https://schema.org/CommentAction
userInteractionCount:1
interactionType:https://schema.org/CommentAction
userInteractionCount:1
External Links {π}(3)
Analytics and Tracking {π}
- Site Verification - Google
Libraries {π}
- Clipboard.js
- D3.js
- Lodash
Emails and Hosting {βοΈ}
Mail Servers:
- aspmx.l.google.com
- alt1.aspmx.l.google.com
- alt2.aspmx.l.google.com
- alt3.aspmx.l.google.com
- alt4.aspmx.l.google.com
Name Servers:
- dns1.p08.nsone.net
- dns2.p08.nsone.net
- dns3.p08.nsone.net
- dns4.p08.nsone.net
- ns-1283.awsdns-32.org
- ns-1707.awsdns-21.co.uk
- ns-421.awsdns-52.com
- ns-520.awsdns-01.net