repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
joke2k/django-environ | import os
import sys
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Path
def test_comparison(volume):
root = Path('/home')
assert root.__eq__(Path('/home'))
assert root in | Path('/') | assert | func_call | tests/test_path.py | test_comparison | 55 | null | |
joke2k/django-environ | import os
import sys
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Path
def test_comparison(volume):
root = Path('/home')
assert root.__eq__(Path('/home'))
assert root in Path('/')
assert root not in Path('/other/path')
assert Path('/home') == | Path('/home') | assert | func_call | tests/test_path.py | test_comparison | 58 | null | |
joke2k/django-environ | from unittest import mock
import pytest
import django
from django.core.exceptions import ImproperlyConfigured
import environ.compat
from environ import Env
from environ.compat import (
PYMEMCACHE_DRIVER,
REDIS_DRIVER,
)
@pytest.mark.parametrize(
'url,backend,location',
[
('dbcache://my_cache_... | backend | assert | variable | tests/test_cache.py | test_cache_parsing | 121 | null | |
joke2k/django-environ | from unittest import mock
import pytest
import django
from django.core.exceptions import ImproperlyConfigured
import environ.compat
from environ import Env
from environ.compat import (
PYMEMCACHE_DRIVER,
REDIS_DRIVER,
)
def test_empty_url_is_mapped_to_empty_config():
assert Env.cache_url_config('') == | {} | assert | collection | tests/test_cache.py | test_empty_url_is_mapped_to_empty_config | 252 | null | |
joke2k/django-environ | import os
import tempfile
from unittest import mock
import logging
import io
import warnings
from urllib.parse import quote
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import DefaultValueWarning, Env, Path
from environ.compat import (
DJANGO_POSTGRES,
REDIS_DRIVER,
)
fro... | host | assert | variable | tests/test_env.py | test_db_url_value | TestEnv | 387 | null |
joke2k/django-environ | import os
from environ import Env
from .fixtures import FakeEnv
_old_environ = None
def setup_module():
"""Setup environment variables to the execution for the current module."""
global _old_environ
_old_environ = os.environ
os.environ = Env.ENVIRON = FakeEnv.generate_data()
def teardown_module():
... | 33.3 | assert | numeric_literal | tests/test_schema.py | test_schema | 42 | null | |
joke2k/django-environ | from unittest import mock
import pytest
import django
from django.core.exceptions import ImproperlyConfigured
import environ.compat
from environ import Env
from environ.compat import (
PYMEMCACHE_DRIVER,
REDIS_DRIVER,
)
@pytest.mark.parametrize(
'chars',
['!', '$', '&', "'", '(', ')', '*', '+', ';', ... | url | assert | variable | tests/test_cache.py | test_cache_url_password_using_sub_delims | 270 | null | |
joke2k/django-environ | import os
import tempfile
from unittest import mock
import logging
import io
import warnings
from urllib.parse import quote
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import DefaultValueWarning, Env, Path
from environ.compat import (
DJANGO_POSTGRES,
REDIS_DRIVER,
)
fro... | 42 | assert | numeric_literal | tests/test_env.py | test_smart_cast | TestEnv | 461 | null |
joke2k/django-environ | import pytest
from environ import Env
def test_solr_parsing(solr_url):
url = Env.search_url_config(solr_url)
assert len(url) == | 2 | assert | numeric_literal | tests/test_search.py | test_solr_parsing | 18 | null | |
joke2k/django-environ | import os
import tempfile
from contextlib import contextmanager
import pytest
import environ
def make_temp_file(text):
with tempfile.NamedTemporaryFile("w", delete=False) as f:
f.write(text)
f.close()
try:
yield f.name
finally:
if os.path.exists(f.name):
os.unl... | "fish" | assert | string_literal | tests/test_fileaware.py | test_mapping | 39 | null | |
joke2k/django-environ | import re
import warnings
import pytest
from environ import Env
from environ.compat import DJANGO_POSTGRES
@pytest.mark.parametrize(
'url,engine,name,host,user,passwd,port',
[
# postgres://user:password@host:port/dbname
('postgres://enigma:secret@example.com:5431/dbname',
DJANGO_POST... | port | assert | variable | tests/test_db.py | test_db_parsing | 226 | null | |
joke2k/django-environ | import pytest
from environ import Env
@pytest.mark.parametrize(
'url,engine,scheme',
[
('elasticsearch://127.0.0.1:9200/index',
'elasticsearch_backend.ElasticsearchSearchEngine',
'http',),
('elasticsearchs://127.0.0.1:9200/index',
'elasticsearch_backend.Elasticsearch... | 'index' | assert | string_literal | tests/test_search.py | test_elasticsearch_parsing | 83 | null | |
joke2k/django-environ | import pytest
from environ import Env
def test_common_args_parsing(search_url):
excluded_indexes = 'myapp.indexes.A,myapp.indexes.B'
include_spelling = 1
batch_size = 100
params = 'EXCLUDED_INDEXES={}&INCLUDE_SPELLING={}&BATCH_SIZE={}'.format(
excluded_indexes,
include_spelling,
... | 100 | assert | numeric_literal | tests/test_search.py | test_common_args_parsing | 156 | null | |
joke2k/django-environ | import os
import tempfile
from contextlib import contextmanager
import pytest
import environ
def make_temp_file(text):
with tempfile.NamedTemporaryFile("w", delete=False) as f:
f.write(text)
f.close()
try:
yield f.name
finally:
if os.path.exists(f.name):
os.unl... | keys | assert | variable | tests/test_fileaware.py | test_iter | 68 | null | |
joke2k/django-environ | import os
from environ import Env
from .fixtures import FakeEnv
_old_environ = None
def setup_module():
"""Setup environment variables to the execution for the current module."""
global _old_environ
_old_environ = os.environ
os.environ = Env.ENVIRON = FakeEnv.generate_data()
def teardown_module():
... | [42, 33] | assert | collection | tests/test_schema.py | test_schema | 48 | null | |
joke2k/django-environ | import pytest
from environ import Env
def test_solr_multicore_parsing(solr_url):
timeout = 360
index = 'solr_index'
url = '{}/{}?TIMEOUT={}'.format(solr_url, index, timeout)
url = Env.search_url_config(url)
assert url['ENGINE'] == 'haystack.backends.solr_backend.SolrEngine'
assert url['URL'] ... | timeout | assert | variable | tests/test_search.py | test_solr_multicore_parsing | 31 | null | |
joke2k/django-environ | from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Env
def test_smtp_ssl_and_options_parsing():
url = (
"smtp+ssl://user@domain.com:password@smtp.example.com:465"
"?EMAIL_USE_SSL=true&timeout=30"
)
url = Env.email_url_config(url)
assert url['EMA... | 'django.core.mail.backends.smtp.EmailBackend' | assert | string_literal | tests/test_email.py | test_smtp_ssl_and_options_parsing | 48 | null | |
joke2k/django-environ | import os
import tempfile
from unittest import mock
import logging
import io
import warnings
from urllib.parse import quote
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import DefaultValueWarning, Env, Path
from environ.compat import (
DJANGO_POSTGRES,
REDIS_DRIVER,
)
fro... | user | assert | variable | tests/test_env.py | test_db_url_value | TestEnv | 388 | null |
joke2k/django-environ | import os
from environ import Env
from .fixtures import FakeEnv
_old_environ = None
def setup_module():
"""Setup environment variables to the execution for the current module."""
global _old_environ
_old_environ = os.environ
os.environ = Env.ENVIRON = FakeEnv.generate_data()
def teardown_module():
... | '42' | assert | string_literal | tests/test_schema.py | test_schema | 55 | null | |
joke2k/django-environ | import pytest
from environ import Env
@pytest.mark.parametrize('flags', ['myflags'])
def test_xapian_parsing(xapian_url, flags):
url = '{}?FLAGS={}'.format(xapian_url, flags)
url = Env.search_url_config(url)
assert url['ENGINE'] == 'haystack.backends.xapian_backend.XapianEngine'
assert 'PATH' in url.... | flags | assert | variable | tests/test_search.py | test_xapian_parsing | 125 | null | |
joke2k/django-environ | from unittest import mock
import pytest
import django
from django.core.exceptions import ImproperlyConfigured
import environ.compat
from environ import Env
from environ.compat import (
PYMEMCACHE_DRIVER,
REDIS_DRIVER,
)
@pytest.mark.parametrize(
'url,backend,location',
[
('dbcache://my_cache_... | location | assert | variable | tests/test_cache.py | test_cache_parsing | 122 | null | |
joke2k/django-environ | from unittest import mock
import pytest
import django
from django.core.exceptions import ImproperlyConfigured
import environ.compat
from environ import Env
from environ.compat import (
PYMEMCACHE_DRIVER,
REDIS_DRIVER,
)
def test_base_options_parsing_memcache():
url = ('memcache://127.0.0.1:11211/?timeout... | 'cache_' | assert | string_literal | tests/test_cache.py | test_base_options_parsing_memcache | 29 | null | |
joke2k/django-environ | import re
import warnings
import pytest
from environ import Env
from environ.compat import DJANGO_POSTGRES
def test_postgres_complex_db_name_parsing():
"""Make sure we can use complex postgres host."""
env_url = (
'postgres://user:password@//cloudsql/'
'project-1234:us-central1:instance/dbnam... | '' | assert | string_literal | tests/test_db.py | test_postgres_complex_db_name_parsing | 262 | null | |
joke2k/django-environ | from unittest import mock
import pytest
import django
from django.core.exceptions import ImproperlyConfigured
import environ.compat
from environ import Env
from environ.compat import (
PYMEMCACHE_DRIVER,
REDIS_DRIVER,
)
def test_base_options_parsing_memcache():
url = ('memcache://127.0.0.1:11211/?timeout... | 1 | assert | numeric_literal | tests/test_cache.py | test_base_options_parsing_memcache | 32 | null | |
joke2k/django-environ | from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Env
def test_invalid_email_schema():
with pytest.raises( | ImproperlyConfigured) | pytest.raises | variable | tests/test_email.py | test_invalid_email_schema | 54 | null | |
joke2k/django-environ | import os
import tempfile
from unittest import mock
import logging
import io
import warnings
from urllib.parse import quote
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import DefaultValueWarning, Env, Path
from environ.compat import (
DJANGO_POSTGRES,
REDIS_DRIVER,
)
fro... | 0 | assert | numeric_literal | tests/test_env.py | test_present_with_callable_default_not_called | TestEnv | 125 | null |
joke2k/django-environ | import pytest
from environ.environ import _cast, _cast_urlstr
@pytest.mark.parametrize(
"quoted_url_str,expected_unquoted_str",
[
("Le-%7BFsIaYnaQw%7Da2B%2F%5BV8bS+", "Le-{FsIaYnaQw}a2B/[V8bS+"),
("my_test-string+", "my_test-string+"),
("my%20test%20string+", "my test string+")
]
)... | expected_unquoted_str | assert | variable | tests/test_utils.py | test_cast_urlstr | 42 | null | |
joke2k/django-environ | import re
import warnings
import pytest
from environ import Env
from environ.compat import DJANGO_POSTGRES
def test_postgres_cluster_with_ipv6_parsing():
"""Parse postgres cluster URLs containing bracketed IPv6 hosts."""
env_url = (
'postgres://username:p@ss:12,wor:34d@'
'host1:111,22.55.44.8... | 'db' | assert | string_literal | tests/test_db.py | test_postgres_cluster_with_ipv6_parsing | 275 | null | |
joke2k/django-environ | import os
import sys
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Path
def test_repr(volume):
root = Path('/home')
if sys.platform == 'win32':
assert root.__repr__() == '<Path:{}home>'.format(volume)
else:
assert root.__repr__() == | '<Path:/home>' | assert | string_literal | tests/test_path.py | test_repr | 49 | null | |
joke2k/django-environ | import os
import sys
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Path
def test_comparison(volume):
root = Path('/home')
assert root.__eq__(Path('/home'))
assert root in Path('/')
assert root not in Path('/other/path')
assert Path('/home') == Path('/h... | '/home' | assert | string_literal | tests/test_path.py | test_comparison | 71 | null | |
joke2k/django-environ | import re
import warnings
import pytest
from environ import Env
from environ.compat import DJANGO_POSTGRES
def test_database_options_parsing():
url = 'postgres://user:pass@host:1234/dbname?conn_max_age=600'
url = Env.db_url_config(url)
assert url['CONN_MAX_AGE'] == | 600 | assert | numeric_literal | tests/test_db.py | test_database_options_parsing | 355 | null | |
joke2k/django-environ | from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Env
def test_invalid_email_schema():
with pytest.raises(ImproperlyConfigured) as exc:
Env.email_url_config('smtp3://user:password@example.com:25')
assert 'Invalid email schema smtp3' == | str(exc.value) | assert | func_call | tests/test_email.py | test_invalid_email_schema | 56 | null | |
joke2k/django-environ | import pytest
from environ import Env
@pytest.mark.parametrize(
'url,engine,scheme',
[
('elasticsearch://127.0.0.1:9200/index',
'elasticsearch_backend.ElasticsearchSearchEngine',
'http',),
('elasticsearchs://127.0.0.1:9200/index',
'elasticsearch_backend.Elasticsearch... | url.keys() | assert | func_call | tests/test_search.py | test_elasticsearch_parsing | 82 | null | |
joke2k/django-environ | import os
import tempfile
from contextlib import contextmanager
import pytest
import environ
def make_temp_file(text):
with tempfile.NamedTemporaryFile("w", delete=False) as f:
f.write(text)
f.close()
try:
yield f.name
finally:
if os.path.exists(f.name):
os.unl... | "banana" | assert | string_literal | tests/test_fileaware.py | test_set_key | TestSetItem | 166 | null |
joke2k/django-environ | import os
import sys
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Path
def test_sum():
"""Make sure Path correct handle __add__."""
assert Path('/') + 'home' == Path('/home')
assert Path('/') + '/home/public' == | Path('/home/public') | assert | func_call | tests/test_path.py | test_sum | 80 | null | |
joke2k/django-environ | def assert_type_and_value(type_, expected, actual):
assert isinstance(actual, type_)
assert actual == | expected | assert | variable | tests/asserts.py | assert_type_and_value | 12 | null | |
joke2k/django-environ | import os
import sys
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Path
def test_str(volume):
root = Path('/home')
if sys.platform == 'win32':
assert str(root) == '{}home'.format(volume)
assert str(root()) == '{}home'.format(volume)
assert ... | '/home/dev' | assert | string_literal | tests/test_path.py | test_str | 29 | null | |
joke2k/django-environ | import re
import warnings
import pytest
from environ import Env
from environ.compat import DJANGO_POSTGRES
def test_database_options_parsing():
url = 'postgres://user:pass@host:1234/dbname?conn_max_age=600'
url = Env.db_url_config(url)
assert url['CONN_MAX_AGE'] == 600
url = ('postgres://user:pass@h... | True | assert | bool_literal | tests/test_db.py | test_database_options_parsing | 361 | null | |
joke2k/django-environ | from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Env
def test_smtp_parsing():
url = 'smtps://user@domain.com:password@smtp.example.com:587'
url = Env.email_url_config(url)
assert len(url) == 7
assert url['EMAIL_BACKEND'] == 'django.core.mail.backends.smtp.Ema... | 587 | assert | numeric_literal | tests/test_email.py | test_smtp_parsing | 26 | null | |
joke2k/django-environ | import pytest
from environ.environ import _cast, _cast_urlstr
@pytest.mark.parametrize(
'literal',
['anything-', 'anything*', '*anything', 'anything.',
'anything.1', '(anything', 'anything-v1.2', 'anything-1.2', 'anything=']
)
def test_cast(literal):
"""Safely evaluate a string containing an invalid ... | literal | assert | variable | tests/test_utils.py | test_cast | 24 | null | |
joke2k/django-environ | import os
import tempfile
from unittest import mock
import logging
import io
import warnings
from urllib.parse import quote
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import DefaultValueWarning, Env, Path
from environ.compat import (
DJANGO_POSTGRES,
REDIS_DRIVER,
)
fro... | 1 | assert | numeric_literal | tests/test_env.py | test_not_present_with_callable_default | TestEnv | 115 | null |
joke2k/django-environ | from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Env
def test_smtp_parsing():
url = 'smtps://user@domain.com:password@smtp.example.com:587'
url = Env.email_url_config(url)
assert len(url) == 7
assert url['EMAIL_BACKEND'] == 'django.core.mail.backends.smtp.Ema... | True | assert | bool_literal | tests/test_email.py | test_smtp_parsing | 27 | null | |
joke2k/django-environ | import os
import tempfile
from contextlib import contextmanager
import pytest
import environ
def make_temp_file(text):
with tempfile.NamedTemporaryFile("w", delete=False) as f:
f.write(text)
f.close()
try:
yield f.name
finally:
if os.path.exists(f.name):
os.unl... | "apple" | assert | string_literal | tests/test_fileaware.py | test_setdefault | 114 | null | |
joke2k/django-environ | import os
from environ import Env
from .fixtures import FakeEnv
_old_environ = None
def setup_module():
"""Setup environment variables to the execution for the current module."""
global _old_environ
_old_environ = os.environ
os.environ = Env.ENVIRON = FakeEnv.generate_data()
def teardown_module():
... | 42 | assert | numeric_literal | tests/test_schema.py | test_schema | 39 | null | |
joke2k/django-environ | from unittest import mock
import pytest
import django
from django.core.exceptions import ImproperlyConfigured
import environ.compat
from environ import Env
from environ.compat import (
PYMEMCACHE_DRIVER,
REDIS_DRIVER,
)
@pytest.mark.parametrize('redis_driver,timeout_key',
[
('django.core.cache.ba... | None | assert | none_literal | tests/test_cache.py | test_base_options_parsing_redis | 56 | null | |
joke2k/django-environ | import os
import tempfile
from unittest import mock
import logging
import io
import warnings
from urllib.parse import quote
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import DefaultValueWarning, Env, Path
from environ.compat import (
DJANGO_POSTGRES,
REDIS_DRIVER,
)
fro... | port | assert | variable | tests/test_env.py | test_db_url_value | TestEnv | 394 | null |
joke2k/django-environ | import os
from environ import Env
from .fixtures import FakeEnv
_old_environ = None
def setup_module():
"""Setup environment variables to the execution for the current module."""
global _old_environ
_old_environ = os.environ
os.environ = Env.ENVIRON = FakeEnv.generate_data()
def teardown_module():
... | None | assert | none_literal | tests/test_schema.py | teardown_module | 30 | null | |
joke2k/django-environ | import re
import warnings
import pytest
from environ import Env
from environ.compat import DJANGO_POSTGRES
def test_memory_sqlite_url_warns_about_netloc(recwarn):
warnings.simplefilter("always")
url = 'sqlite://missing-slash-path'
url = Env.db_url_config(url)
assert len(recwarn) == | 1 | assert | numeric_literal | tests/test_db.py | test_memory_sqlite_url_warns_about_netloc | 332 | null | |
joke2k/django-environ | import os
import tempfile
from unittest import mock
import logging
import io
import warnings
from urllib.parse import quote
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import DefaultValueWarning, Env, Path
from environ.compat import (
DJANGO_POSTGRES,
REDIS_DRIVER,
)
fro... | name | assert | variable | tests/test_env.py | test_db_url_value | TestEnv | 386 | null |
joke2k/django-environ | import os
import sys
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Path
def test_path_class():
root = Path(__file__, '..', is_file=True)
root_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '../'))
assert root() == | root_path | assert | variable | tests/test_path.py | test_path_class | 36 | null | |
joke2k/django-environ | import pytest
from environ import Env
def test_solr_multicore_parsing(solr_url):
timeout = 360
index = 'solr_index'
url = '{}/{}?TIMEOUT={}'.format(solr_url, index, timeout)
url = Env.search_url_config(url)
assert url['ENGINE'] == 'haystack.backends.solr_backend.SolrEngine'
assert url['URL'] ... | url | assert | variable | tests/test_search.py | test_solr_multicore_parsing | 32 | null | |
joke2k/django-environ | import re
import warnings
import pytest
from environ import Env
from environ.compat import DJANGO_POSTGRES
def test_database_options_parsing():
url = 'postgres://user:pass@host:1234/dbname?conn_max_age=600'
url = Env.db_url_config(url)
assert url['CONN_MAX_AGE'] == 600
url = ('postgres://user:pass@h... | False | assert | bool_literal | tests/test_db.py | test_database_options_parsing | 362 | null | |
joke2k/django-environ | import re
import warnings
import pytest
from environ import Env
from environ.compat import DJANGO_POSTGRES
def test_unknown_engine_warns_and_returns_empty_dict(recwarn):
result = Env.db_url_config('localhost')
assert result == | {} | assert | collection | tests/test_db.py | test_unknown_engine_warns_and_returns_empty_dict | 451 | null | |
joke2k/django-environ | import os
import sys
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Path
def test_subtraction_not_int():
"""Subtraction with an invalid type should raise TypeError."""
with pytest.raises( | TypeError) | pytest.raises | variable | tests/test_path.py | test_subtraction_not_int | 91 | null | |
joke2k/django-environ | from unittest import mock
import pytest
import django
from django.core.exceptions import ImproperlyConfigured
import environ.compat
from environ import Env
from environ.compat import (
PYMEMCACHE_DRIVER,
REDIS_DRIVER,
)
def test_cache_url_env_using_default():
env = Env(CACHE_URL=(str, "locmemcache://"))
... | "" | assert | string_literal | tests/test_cache.py | test_cache_url_env_using_default | 338 | null | |
joke2k/django-environ | from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Env
def test_smtp_parsing():
url = 'smtps://user@domain.com:password@smtp.example.com:587'
url = Env.email_url_config(url)
assert len(url) == 7
assert url['EMAIL_BACKEND'] == 'django.core.mail.backends.smtp.Ema... | '' | assert | string_literal | tests/test_email.py | test_smtp_parsing | 28 | null | |
joke2k/django-environ | import os
import sys
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Path
def test_subtraction():
"""Make sure Path correct handle __sub__."""
assert Path('/home/dev/public') - 2 == Path('/home')
assert Path('/home/dev/public') - 'public' == | Path('/home/dev') | assert | func_call | tests/test_path.py | test_subtraction | 86 | null | |
joke2k/django-environ | from unittest import mock
import pytest
import django
from django.core.exceptions import ImproperlyConfigured
import environ.compat
from environ import Env
from environ.compat import (
PYMEMCACHE_DRIVER,
REDIS_DRIVER,
)
def test_options_parsing():
url = 'filecache:///var/tmp/django_cache?timeout=60&max_e... | 60 | assert | numeric_literal | tests/test_cache.py | test_options_parsing | 224 | null | |
joke2k/django-environ | import pytest
from environ import Env
@pytest.mark.parametrize('storage', ['file', 'ram'])
def test_whoosh_parsing(whoosh_url, storage):
post_limit = 128 * 1024 * 1024
url = '{}?STORAGE={}&POST_LIMIT={}'.format(whoosh_url, storage, post_limit)
url = Env.search_url_config(url)
assert url['ENGINE'] == ... | storage | assert | variable | tests/test_search.py | test_whoosh_parsing | 110 | null | |
joke2k/django-environ | import os
from environ import Env
from .fixtures import FakeEnv
_old_environ = None
def setup_module():
"""Setup environment variables to the execution for the current module."""
global _old_environ
_old_environ = os.environ
os.environ = Env.ENVIRON = FakeEnv.generate_data()
def teardown_module():
... | [2] | assert | collection | tests/test_schema.py | test_schema | 51 | null | |
joke2k/django-environ | from environ import Env
import pytest
from django.core.exceptions import ImproperlyConfigured
def test_channels_parsing():
url = "inmemory://"
result = Env.channels_url_config(url)
assert result["BACKEND"] == | "channels.layers.InMemoryChannelLayer" | assert | string_literal | tests/test_channels.py | test_channels_parsing | 18 | null | |
joke2k/django-environ | from environ import Env
import pytest
from django.core.exceptions import ImproperlyConfigured
def test_channels_invalid_schema():
with pytest.raises( | ImproperlyConfigured) | pytest.raises | variable | tests/test_channels.py | test_channels_invalid_schema | 46 | null | |
joke2k/django-environ | import os
import sys
from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Path
def test_complex_manipulation(volume):
root = Path('/home')
public = root.path('public')
assets, scripts = public.path('assets'), public.path('assets', 'scripts')
if sys.platform == 'w... | '/home/public' | assert | string_literal | tests/test_path.py | test_complex_manipulation | 136 | null | |
joke2k/django-environ | from django.core.exceptions import ImproperlyConfigured
import pytest
from environ import Env
def test_smtp_parsing():
url = 'smtps://user@domain.com:password@smtp.example.com:587'
url = Env.email_url_config(url)
assert len(url) == 7
assert url['EMAIL_BACKEND'] == 'django.core.mail.backends.smtp.Ema... | 'password' | assert | string_literal | tests/test_email.py | test_smtp_parsing | 24 | null | |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from homeassistant import const as hac
from homeassistant.config_entries import ConfigEntryState
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.helpers.component_api import ComponentApi
from custom_components.meross_lan.light imp... | ComponentApi | assert | variable | tests/test_config_entry.py | test_mqtthub_entry | 40 | null | |
krahabb/meross_lan | from typing import TYPE_CHECKING
from unittest import mock
from homeassistant.helpers import device_registry as dr
from pytest_homeassistant_custom_component.common import flush_store
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.helpers.meross_profile import MerossProfile
fr... | 1 | assert | numeric_literal | tests/test_meross_profile.py | test_meross_profile | 49 | null | |
krahabb/meross_lan | from homeassistant.components import number as haec
from custom_components.meross_lan.cover import MLRollerShutterConfigNumber
from custom_components.meross_lan.devices.garagedoor import (
MLGarageConfigNumber,
MLGarageMultipleConfigNumber,
)
from custom_components.meross_lan.devices.hub import (
HubSensor... | entity.max_value | assert | complex_expr | tests/entities/number.py | async_test_enabled_callback | EntityTest | 134 | null |
krahabb/meross_lan | import asyncio
import base64
from collections import namedtuple
import contextlib
from copy import deepcopy
from datetime import UTC, datetime, timedelta
import hashlib
import logging
import re
import time
from typing import TYPE_CHECKING
from unittest.mock import ANY, MagicMock, patch
import aiohttp
from freezegun.ap... | next_step_id | assert | variable | tests/helpers.py | async_assert_flow_menu_to_step | 118 | null | |
krahabb/meross_lan | from homeassistant.components.calendar import CalendarEntity
from custom_components.meross_lan.calendar import MtsSchedule
from custom_components.meross_lan.devices.hub.mts100 import Mts100Climate
from custom_components.meross_lan.devices.thermostat.mts200 import Mts200Climate
from custom_components.meross_lan.devices... | 15 | assert | numeric_literal | tests/entities/calendar.py | async_test_each_callback | EntityTest | 41 | null |
krahabb/meross_lan | from homeassistant.components import cover as haec
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.cover import MLCover, MLRollerShutter
from custom_components.meross_lan.devices.garagedoor import MLGarage
from custom_components.meross_lan.merossclient.protocol import (
cons... | 0 | assert | numeric_literal | tests/entities/cover.py | async_test_enabled_callback | EntityTest | 77 | null |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from uuid import uuid4
from homeassistant import config_entries
from homeassistant.components import dhcp
from homeassistant.config_entries import ConfigEntry, ConfigEntryState, ConfigFlowResult
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeas... | "hub" | assert | string_literal | tests/test_config_flow.py | test_mqtt_discovery_config_flow | 267 | null | |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from homeassistant import const as hac
from homeassistant.config_entries import ConfigEntryState
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.helpers.component_api import ComponentApi
from custom_components.meross_lan.light imp... | None | assert | none_literal | tests/test_config_entry.py | test_profile_entry | 121 | null | |
krahabb/meross_lan | from homeassistant.components import cover as haec
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.cover import MLCover, MLRollerShutter
from custom_components.meross_lan.devices.garagedoor import MLGarage
from custom_components.meross_lan.merossclient.protocol import (
cons... | haec.CoverEntityFeature.OPEN | haec.CoverEntityFeature.CLOSE | assert | complex_expr | tests/entities/cover.py | async_test_each_callback | EntityTest | 44 | null |
krahabb/meross_lan | from time import time
import typing
from pytest_homeassistant_custom_component.common import async_fire_mqtt_message
from custom_components.meross_lan.merossclient import json_dumps
from custom_components.meross_lan.merossclient.protocol import (
const as mc,
namespaces as mn,
)
from custom_components.meross_... | helpers.MessageMatcher(header=header_consumption_reply)) | assert_* | func_call | tests/test_merossapi.py | test_hamqtt_device_session | 123 | null | |
krahabb/meross_lan | import asyncio
import base64
from collections import namedtuple
import contextlib
from copy import deepcopy
from datetime import UTC, datetime, timedelta
import hashlib
import logging
import re
import time
from typing import TYPE_CHECKING
from unittest.mock import ANY, MagicMock, patch
import aiohttp
from freezegun.ap... | FlowResultType.MENU | assert | complex_expr | tests/helpers.py | async_assert_flow_menu_to_step | 110 | null | |
krahabb/meross_lan | from homeassistant.components import media_player as haec # HA EntityComponent
from custom_components.meross_lan.media_player import MLMp3Player
from custom_components.meross_lan.merossclient.protocol import (
const as mc,
namespaces as mn,
)
from tests.entities import EntityComponentTest
class EntityTest(E... | 1 | assert | numeric_literal | tests/entities/media_player.py | async_test_enabled_callback | EntityTest | 47 | null |
krahabb/meross_lan | from homeassistant.helpers.aiohttp_client import async_get_clientsession
from custom_components.meross_lan.merossclient import cloudapi
from . import const as tc, helpers
async def test_cloudapi(hass, cloudapi_mock: helpers.CloudApiMocker):
cloudapiclient = cloudapi.CloudApiClient(session=async_get_clientsession... | tc.MOCK_CLOUDAPI_DEVICE_LATESTVERSION | assert | complex_expr | tests/test_merossclient.py | test_cloudapi | 28 | null | |
krahabb/meross_lan | from homeassistant.helpers.aiohttp_client import async_get_clientsession
from custom_components.meross_lan.merossclient import cloudapi
from . import const as tc, helpers
async def test_cloudapi(hass, cloudapi_mock: helpers.CloudApiMocker):
cloudapiclient = cloudapi.CloudApiClient(session=async_get_clientsession... | tc.MOCK_PROFILE_CREDENTIALS_SIGNIN | assert | complex_expr | tests/test_merossclient.py | test_cloudapi | 22 | null | |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from uuid import uuid4
from homeassistant import config_entries
from homeassistant.components import dhcp
from homeassistant.config_entries import ConfigEntry, ConfigEntryState, ConfigFlowResult
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeas... | "profile" | assert | string_literal | tests/test_config_flow.py | test_profile_config_flow | 136 | null | |
krahabb/meross_lan | from homeassistant.components import cover as haec
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.cover import MLCover, MLRollerShutter
from custom_components.meross_lan.devices.garagedoor import MLGarage
from custom_components.meross_lan.merossclient.protocol import (
cons... | entity.supported_features | assert | complex_expr | tests/entities/cover.py | async_test_enabled_callback | EntityTest | 74 | null |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from uuid import uuid4
from homeassistant import config_entries
from homeassistant.components import dhcp
from homeassistant.config_entries import ConfigEntry, ConfigEntryState, ConfigFlowResult
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeas... | 1) | assert_* | numeric_literal | tests/test_config_flow.py | test_dhcp_renewal_config_flow | 461 | null | |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from uuid import uuid4
from homeassistant import config_entries
from homeassistant.components import dhcp
from homeassistant.config_entries import ConfigEntry, ConfigEntryState, ConfigFlowResult
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeas... | "finalize" | assert | string_literal | tests/test_config_flow.py | test_device_config_flow | 75 | null | |
krahabb/meross_lan | from homeassistant.components import fan as haec
from custom_components.meross_lan.fan import MLFan
from custom_components.meross_lan.merossclient.protocol import (
const as mc,
namespaces as mn,
)
from tests.entities import EntityComponentTest
class EntityTest(EntityComponentTest):
ENTITY_TYPE = haec.F... | percentage | assert | variable | tests/entities/fan.py | async_test_enabled_callback | EntityTest | 34 | null |
krahabb/meross_lan | from homeassistant import const as hac
from homeassistant.components import light as haec
from homeassistant.components.light import ColorMode, LightEntity, LightEntityFeature
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.devices.diffuser import MLDiffuserLight
from custom_com... | {ColorMode.ONOFF} | assert | collection | tests/entities/light.py | async_test_each_callback | EntityTest | 49 | null |
krahabb/meross_lan | from typing import TYPE_CHECKING
from unittest import mock
from homeassistant.helpers import device_registry as dr
from pytest_homeassistant_custom_component.common import flush_store
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.helpers.meross_profile import MerossProfile
fr... | None | assert | none_literal | tests/test_meross_profile.py | test_meross_profile | 93 | null | |
krahabb/meross_lan | from homeassistant.components import climate as haec
from homeassistant.components.climate import ClimateEntity, HVACMode
from custom_components.meross_lan.climate import MtsClimate
from custom_components.meross_lan.devices.hub.mts100 import Mts100Climate
from custom_components.meross_lan.devices.thermostat.mts200 imp... | None | assert | none_literal | tests/entities/climate.py | async_test_each_callback | EntityTest | 93 | null |
krahabb/meross_lan | import datetime as dt
import typing
from zoneinfo import ZoneInfo
from homeassistant.const import STATE_UNAVAILABLE
import homeassistant.util.dt as dt_util
import pytest
from pytest_homeassistant_custom_component.components.recorder.common import (
async_wait_recording_done,
)
from custom_components.meross_lan im... | TEST_POWER | assert | variable | tests/test_consumption.py | _async_configure_context | 95 | null | |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from uuid import uuid4
from homeassistant import config_entries
from homeassistant.components import dhcp
from homeassistant.config_entries import ConfigEntry, ConfigEntryState, ConfigFlowResult
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeas... | host | assert | variable | tests/test_config_flow.py | test_device_config_flow | 85 | null | |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from uuid import uuid4
from homeassistant import config_entries
from homeassistant.components import dhcp
from homeassistant.config_entries import ConfigEntry, ConfigEntryState, ConfigFlowResult
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeas... | descriptor.all | assert | complex_expr | tests/test_config_flow.py | test_device_config_flow | 95 | null | |
krahabb/meross_lan | from homeassistant.helpers.aiohttp_client import async_get_clientsession
from custom_components.meross_lan.merossclient import cloudapi
from . import const as tc, helpers
async def test_cloudapi(hass, cloudapi_mock: helpers.CloudApiMocker):
cloudapiclient = cloudapi.CloudApiClient(session=async_get_clientsession... | list(tc.MOCK_CLOUDAPI_DEVICE_DEVLIST.values()) | assert | func_call | tests/test_merossclient.py | test_cloudapi | 25 | null | |
krahabb/meross_lan | import asyncio
import base64
from collections import namedtuple
import contextlib
from copy import deepcopy
from datetime import UTC, datetime, timedelta
import hashlib
import logging
import re
import time
from typing import TYPE_CHECKING
from unittest.mock import ANY, MagicMock, patch
import aiohttp
from freezegun.ap... | hashlib.md5( (cloudapi.SECRET + str(timestamp) + nonce + params).encode("utf-8") ).hexdigest() | assert | func_call | tests/helpers.py | _validate_request_payload | CloudApiMocker | 953 | null |
krahabb/meross_lan | from homeassistant.components import climate as haec
from homeassistant.components.climate import ClimateEntity, HVACMode
from custom_components.meross_lan.climate import MtsClimate
from custom_components.meross_lan.devices.hub.mts100 import Mts100Climate
from custom_components.meross_lan.devices.thermostat.mts200 imp... | preset_mode | assert | variable | tests/entities/climate.py | async_test_enabled_callback | EntityTest | 110 | null |
krahabb/meross_lan | from homeassistant.components import cover as haec
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.cover import MLCover, MLRollerShutter
from custom_components.meross_lan.devices.garagedoor import MLGarage
from custom_components.meross_lan.merossclient.protocol import (
cons... | trans[1] | assert | complex_expr | tests/entities/cover.py | _async_test_garage_transition | EntityTest | 115 | null |
krahabb/meross_lan | from homeassistant.components import cover as haec
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.cover import MLCover, MLRollerShutter
from custom_components.meross_lan.devices.garagedoor import MLGarage
from custom_components.meross_lan.merossclient.protocol import (
cons... | trans[2] | assert | complex_expr | tests/entities/cover.py | _async_test_garage_transition | EntityTest | 125 | null |
krahabb/meross_lan | from homeassistant.components import climate as haec
from homeassistant.components.climate import ClimateEntity, HVACMode
from custom_components.meross_lan.climate import MtsClimate
from custom_components.meross_lan.devices.hub.mts100 import Mts100Climate
from custom_components.meross_lan.devices.thermostat.mts200 imp... | Mts960Climate | assert | variable | tests/entities/climate.py | async_test_each_callback | EntityTest | 85 | null |
krahabb/meross_lan | from homeassistant.components import cover as haec
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.cover import MLCover, MLRollerShutter
from custom_components.meross_lan.devices.garagedoor import MLGarage
from custom_components.meross_lan.merossclient.protocol import (
cons... | excpected_state | assert | variable | tests/entities/cover.py | _async_test_stop | EntityTest | 222 | null |
krahabb/meross_lan | from homeassistant.components import select as haec
from custom_components.meross_lan.climate import MtsClimate
from custom_components.meross_lan.devices.diffuser import MLDiffuserSpray
from custom_components.meross_lan.devices.spray import MLSpray
from custom_components.meross_lan.devices.thermostat.mts300 import Mts... | option | assert | variable | tests/entities/select.py | async_test_enabled_callback | EntityTest | 50 | null |
krahabb/meross_lan | import asyncio
from typing import TYPE_CHECKING
from uuid import uuid4
from homeassistant import config_entries
from homeassistant.components import dhcp
from homeassistant.config_entries import ConfigEntry, ConfigEntryState, ConfigFlowResult
from homeassistant.data_entry_flow import FlowResultType
from pytest_homeas... | DHCP_GOOD_HOST | assert | variable | tests/test_config_flow.py | test_dhcp_renewal_config_flow | 430 | null | |
krahabb/meross_lan | from homeassistant.components import cover as haec
from custom_components.meross_lan import const as mlc
from custom_components.meross_lan.cover import MLCover, MLRollerShutter
from custom_components.meross_lan.devices.garagedoor import MLGarage
from custom_components.meross_lan.merossclient.protocol import (
cons... | haec.CoverEntityFeature.OPEN | haec.CoverEntityFeature.CLOSE | haec.CoverEntityFeature.STOP | assert | complex_expr | tests/entities/cover.py | async_test_each_callback | EntityTest | 51 | null |
krahabb/meross_lan | import asyncio
import base64
from collections import namedtuple
import contextlib
from copy import deepcopy
from datetime import UTC, datetime, timedelta
import hashlib
import logging
import re
import time
from typing import TYPE_CHECKING
from unittest.mock import ANY, MagicMock, patch
import aiohttp
from freezegun.ap... | next_step_type | assert | variable | tests/helpers.py | async_assert_flow_menu_to_step | 116 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.