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
eliangcs/pystock-crawler
import os import tempfile from scrapy.http import TextResponse from pystock_crawler.spiders.yahoo import make_url, YahooSpider from pystock_crawler.tests.base import TestCaseBase class YahooSpiderTest(TestCaseBase): def test_inline_symbols(self): spider = YahooSpider(symbols='C') self.assertEqua...
[ make_url(symbol) for symbol in ('KO', 'DIS', 'ATVI') ])
self.assertEqual
collection
pystock_crawler/tests/test_spiders_yahoo.py
test_inline_symbols
YahooSpiderTest
48
null
eliangcs/pystock-crawler
import os import requests import urlparse from scrapy.http.response.xml import XmlResponse from pystock_crawler.loaders import ReportItemLoader from pystock_crawler.tests.base import SAMPLE_DATA_DIR, TestCaseBase def create_response(file_path): with open(file_path) as f: body = f.read() return XmlRes...
{ 'symbol': 'L', 'amend': False, 'doc_type': '10-Q', 'period_focus': 'Q3', 'fiscal_year': 2010, 'end_date': '2010-09-30', 'revenues': 3701000000, 'op_income': None, 'net_income': 36000000, 'eps_basic': 0.09, 'eps_diluted': 0.09, 'dividend': 0.0625, 'assets': 76821000000, 'cur_assets': None, 'cur_liab': None, 'equity': ...
assert_*
collection
pystock_crawler/tests/test_loaders.py
test_l_20100930
ReportItemLoaderTest
2,080
null
eliangcs/pystock-crawler
import os import unittest SAMPLE_DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'sample_data') class TestCaseBase(unittest.TestCase): def assert_none_or_almost_equal(self, value, expected_value): if expected_value is None: self.assertIsNone(value) else: ...
expected.get('symbol'))
self.assertEqual
func_call
pystock_crawler/tests/base.py
assert_item
TestCaseBase
21
null
eliangcs/pystock-crawler
import os import requests import urlparse from scrapy.http.response.xml import XmlResponse from pystock_crawler.loaders import ReportItemLoader from pystock_crawler.tests.base import SAMPLE_DATA_DIR, TestCaseBase def create_response(file_path): with open(file_path) as f: body = f.read() return XmlRes...
{ 'symbol': 'AXP', 'amend': False, 'doc_type': '10-Q', 'period_focus': 'Q1', 'fiscal_year': 2013, 'end_date': '2013-03-31', 'revenues': 7384000000, 'op_income': None, 'net_income': 1280000000, 'eps_basic': 1.15, 'eps_diluted': 1.15, 'dividend': 0.2, 'assets': 156855000000, 'cur_assets': None, 'cur_liab': None, 'equity'...
assert_*
collection
pystock_crawler/tests/test_loaders.py
test_axp_20130331
ReportItemLoaderTest
428
null
eliangcs/pystock-crawler
import os import unittest SAMPLE_DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'sample_data') class TestCaseBase(unittest.TestCase): def assert_none_or_almost_equal(self, value, expected_value): if expected_value is None: self.assertIsNone(
value)
self.assertIsNone
variable
pystock_crawler/tests/base.py
assert_none_or_almost_equal
TestCaseBase
16
null
eliangcs/pystock-crawler
import os import tempfile from scrapy.http import HtmlResponse, XmlResponse from pystock_crawler.spiders.edgar import EdgarSpider, URLGenerator from pystock_crawler.tests.base import TestCaseBase def make_url(symbol, start_date='', end_date=''): '''A URL that lists all 10-Q and 10-K filings of a company.''' ...
[ make_url('TSLA', end_date='20110530'), make_url('USO', end_date='20110530'), make_url('MMM', end_date='20110530') ])
self.assertEqual
collection
pystock_crawler/tests/test_spiders_edgar.py
test_with_end_date
URLGeneratorTest
38
null
eliangcs/pystock-crawler
import os import tempfile from scrapy.http import HtmlResponse, XmlResponse from pystock_crawler.spiders.edgar import EdgarSpider, URLGenerator from pystock_crawler.tests.base import TestCaseBase def make_url(symbol, start_date='', end_date=''): '''A URL that lists all 10-Q and 10-K filings of a company.''' ...
[ make_url('FB'), make_url('GOOG') ])
self.assertEqual
collection
pystock_crawler/tests/test_spiders_edgar.py
test_no_dates
URLGeneratorTest
24
null
eliangcs/pystock-crawler
import os import tempfile from scrapy.http import TextResponse from pystock_crawler.spiders.yahoo import make_url, YahooSpider from pystock_crawler.tests.base import TestCaseBase class YahooSpiderTest(TestCaseBase): def test_inline_symbols(self): spider = YahooSpider(symbols='C') self.assertEqu...
[make_url('C')])
self.assertEqual
collection
pystock_crawler/tests/test_spiders_yahoo.py
test_inline_symbols
YahooSpiderTest
45
null
eliangcs/pystock-crawler
import os import tempfile from scrapy.http import TextResponse from pystock_crawler.spiders.yahoo import make_url, YahooSpider from pystock_crawler.tests.base import TestCaseBase class MakeURLTest(TestCaseBase): def test_no_dates(self): self
'http://ichart.finance.yahoo.com/table.csv?' 's=YHOO&d=&e=&f=&g=d&a=&b=&c=&ignore=.csv')
self.assertEqual
string_literal
pystock_crawler/tests/test_spiders_yahoo.py
test_no_dates
MakeURLTest
13
null
eliangcs/pystock-crawler
import os import tempfile from scrapy.http import TextResponse from pystock_crawler.spiders.yahoo import make_url, YahooSpider from pystock_crawler.tests.base import TestCaseBase class YahooSpiderTest(TestCaseBase): def test_parse(self): spider = YahooSpider() body = ('Date,Open,High,Low,Close,...
3)
self.assertEqual
numeric_literal
pystock_crawler/tests/test_spiders_yahoo.py
test_parse
YahooSpiderTest
82
null
eliangcs/pystock-crawler
import os import tempfile from scrapy.http import HtmlResponse, XmlResponse from pystock_crawler.spiders.edgar import EdgarSpider, URLGenerator from pystock_crawler.tests.base import TestCaseBase def make_url(symbol, start_date='', end_date=''): '''A URL that lists all 10-Q and 10-K filings of a company.''' ...
{ 'symbol': 'ABC', 'amend': False, 'doc_type': '10-Q', 'period_focus': 'Q2', 'fiscal_year': 2013, 'end_date': '2013-06-28', 'revenues': 100.0, 'net_income': 200.0, 'eps_basic': 0.2, 'eps_diluted': 0.19, 'dividend': 0.07, 'assets': 1600.0, 'equity': 300.0, 'cash': 150.0 })
assert_*
collection
pystock_crawler/tests/test_spiders_edgar.py
test_parse_xml_report
EdgarSpiderTest
207
null
eliangcs/pystock-crawler
import os import unittest SAMPLE_DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'sample_data') class TestCaseBase(unittest.TestCase): def assert_none_or_almost_equal(self, value, expected_value): if expected_value is None: self.assertIsNone(value) else: ...
expected_value)
self.assertAlmostEqual
variable
pystock_crawler/tests/base.py
assert_none_or_almost_equal
TestCaseBase
18
null
eliangcs/pystock-crawler
import cStringIO import os from pystock_crawler import utils from pystock_crawler.tests.base import SAMPLE_DATA_DIR, TestCaseBase class UtilsTest(TestCaseBase): def test_parse_limit_arg(self): self.assertEqual(utils.parse_limit_arg(''),
(0, None))
self.assertEqual
collection
pystock_crawler/tests/test_utils.py
test_parse_limit_arg
UtilsTest
32
null
eliangcs/pystock-crawler
import os import tempfile from scrapy.http import TextResponse from pystock_crawler.spiders.yahoo import make_url, YahooSpider from pystock_crawler.tests.base import TestCaseBase class YahooSpiderTest(TestCaseBase): def test_illegal_dates(self): with self.assertRaises(
ValueError)
self.assertRaises
variable
pystock_crawler/tests/test_spiders_yahoo.py
test_illegal_dates
YahooSpiderTest
66
null
eliangcs/pystock-crawler
import os import tempfile from scrapy.http import TextResponse from pystock_crawler.spiders.yahoo import make_url, YahooSpider from pystock_crawler.tests.base import TestCaseBase class YahooSpiderTest(TestCaseBase): def test_parse(self): spider = YahooSpider() body = ('Date,Open,High,Low,Close,...
{ 'symbol': 'YHOO', 'date': '2013-09-06', 'open': 168.57, 'high': 169.70, 'low': 165.15, 'close': 166.97, 'volume': 8619700, 'adj_close': 166.97 })
assert_*
collection
pystock_crawler/tests/test_spiders_yahoo.py
test_parse
YahooSpiderTest
93
null
eliangcs/pystock-crawler
import os import shutil import unittest import pystock_crawler from envoy import run TEST_DIR = './test_data' os.environ['PYTHONPATH'] = os.getcwd() class CrawlSymbolsTest(CrawlTest): filename = 'symbols' spider = 'nasdaq' def assert_nyse_output(self): # Check if some common NYSE symbols are ...
0)
self.assertEqual
numeric_literal
pystock_crawler/tests/test_cmdline.py
test_crawl_nyse
CrawlSymbolsTest
107
null
eliangcs/pystock-crawler
import os import tempfile from scrapy.http import HtmlResponse, XmlResponse from pystock_crawler.spiders.edgar import EdgarSpider, URLGenerator from pystock_crawler.tests.base import TestCaseBase def make_url(symbol, start_date='', end_date=''): '''A URL that lists all 10-Q and 10-K filings of a company.''' ...
[ make_url('DDD', '20111230', '20121230'), make_url('AXP', '20111230', '20121230'), make_url('KO', '20111230', '20121230') ])
self.assertEqual
collection
pystock_crawler/tests/test_spiders_edgar.py
test_with_start_and_end_dates
URLGeneratorTest
46
null
eliangcs/pystock-crawler
import os import requests import urlparse from scrapy.http.response.xml import XmlResponse from pystock_crawler.loaders import ReportItemLoader from pystock_crawler.tests.base import SAMPLE_DATA_DIR, TestCaseBase def create_response(file_path): with open(file_path) as f: body = f.read() return XmlRes...
{ 'symbol': 'TRV', 'amend': False, 'doc_type': '10-Q', 'period_focus': 'Q1', 'fiscal_year': 2010, 'end_date': '2010-03-31', 'revenues': 6119000000, 'op_income': None, 'net_income': 647000000, 'eps_basic': 1.26, 'eps_diluted': 1.25, 'dividend': 0.0, 'assets': 108696000000, 'cur_assets': None, 'cur_liab': None, 'equity':...
assert_*
collection
pystock_crawler/tests/test_loaders.py
test_trv_20100331
ReportItemLoaderTest
3,311
null
eliangcs/pystock-crawler
import os import requests import urlparse from scrapy.http.response.xml import XmlResponse from pystock_crawler.loaders import ReportItemLoader from pystock_crawler.tests.base import SAMPLE_DATA_DIR, TestCaseBase def create_response(file_path): with open(file_path) as f: body = f.read() return XmlRes...
{ 'symbol': 'CI', 'amend': False, 'doc_type': '10-Q', 'period_focus': 'Q1', 'fiscal_year': 2013, 'end_date': '2013-03-31', 'revenues': 8183000000, 'op_income': None, 'net_income': 57000000, 'eps_basic': 0.2, 'eps_diluted': 0.2, 'dividend': 0.04, 'assets': 54939000000, 'cur_assets': None, 'cur_liab': None, 'equity': 966...
assert_*
collection
pystock_crawler/tests/test_loaders.py
test_ci_20130331
ReportItemLoaderTest
828
null
eliangcs/pystock-crawler
import os import tempfile from scrapy.http import TextResponse from pystock_crawler.spiders.yahoo import make_url, YahooSpider from pystock_crawler.tests.base import TestCaseBase class YahooSpiderTest(TestCaseBase): def test_parse(self): spider = YahooSpider() body = ('Date,Open,High,Low,Close,...
{ 'symbol': 'YHOO', 'date': '2013-06-26', 'open': 103.80, 'high': 105.87, 'low': 102.66, 'close': 105.72, 'volume': 6602600, 'adj_close': 105.72 })
assert_*
collection
pystock_crawler/tests/test_spiders_yahoo.py
test_parse
YahooSpiderTest
103
null
eliangcs/pystock-crawler
import os import unittest SAMPLE_DATA_DIR = os.path.join(os.path.abspath(os.path.dirname(__file__)), 'sample_data') class TestCaseBase(unittest.TestCase): def assert_none_or_almost_equal(self, value, expected_value): if expected_value is None: self.assertIsNone(value) else: ...
expected.get('assets'))
assert_*
func_call
pystock_crawler/tests/base.py
assert_item
TestCaseBase
33
null
eliangcs/pystock-crawler
import os import requests import urlparse from scrapy.http.response.xml import XmlResponse from pystock_crawler.loaders import ReportItemLoader from pystock_crawler.tests.base import SAMPLE_DATA_DIR, TestCaseBase def create_response(file_path): with open(file_path) as f: body = f.read() return XmlRes...
{ 'symbol': 'L', 'amend': False, 'doc_type': '10-Q', 'period_focus': 'Q1', 'fiscal_year': 2010, 'end_date': '2010-03-31', 'revenues': 3713000000, 'op_income': None, 'net_income': 420000000, 'eps_basic': 0.99, 'eps_diluted': 0.99, 'dividend': 0.0625, 'assets': 75855000000, 'cur_assets': None, 'cur_liab': None, 'equity':...
assert_*
collection
pystock_crawler/tests/test_loaders.py
test_l_20100331
ReportItemLoaderTest
2,055
null
eliangcs/pystock-crawler
import os import requests import urlparse from scrapy.http.response.xml import XmlResponse from pystock_crawler.loaders import ReportItemLoader from pystock_crawler.tests.base import SAMPLE_DATA_DIR, TestCaseBase def create_response(file_path): with open(file_path) as f: body = f.read() return XmlRes...
{ 'symbol': 'FLL', 'amend': False, 'doc_type': '10-K', 'period_focus': 'FY', 'fiscal_year': 2012, 'end_date': '2012-12-31', 'revenues': 128760000, 'op_income': 49638000, 'net_income': 27834000, 'eps_basic': 1.49, 'eps_diluted': None, 'dividend': 0.0, 'assets': 162725000, 'cur_assets': 32339000, 'cur_liab': 15332000, 'e...
assert_*
collection
pystock_crawler/tests/test_loaders.py
test_fll_20121231
ReportItemLoaderTest
1,279
null
eliangcs/pystock-crawler
import os import requests import urlparse from scrapy.http.response.xml import XmlResponse from pystock_crawler.loaders import ReportItemLoader from pystock_crawler.tests.base import SAMPLE_DATA_DIR, TestCaseBase def create_response(file_path): with open(file_path) as f: body = f.read() return XmlRes...
{ 'symbol': 'CIT', 'amend': False, 'doc_type': '10-Q', 'period_focus': 'Q2', 'fiscal_year': 2010, 'end_date': '2010-06-30', 'revenues': 669500000, 'op_income': None, 'net_income': 142100000, 'eps_basic': 0.71, 'eps_diluted': 0.71, 'dividend': 0.0, 'assets': 54916800000, 'cur_assets': None, 'cur_liab': None, 'equity': 8...
assert_*
collection
pystock_crawler/tests/test_loaders.py
test_cit_20100630
ReportItemLoaderTest
853
null
eliangcs/pystock-crawler
from scrapy.http import TextResponse from pystock_crawler.spiders.nasdaq import NasdaqSpider from pystock_crawler.tests.base import TestCaseBase class NasdaqSpiderTest(TestCaseBase): def test_parse(self): spider = NasdaqSpider() body = ('"Symbol","Name","Doesnt Matter",\n' '"DDD"...
{ 'symbol': 'WBS', 'name': 'Webster Financial Corporation' })
assert_*
collection
pystock_crawler/tests/test_spiders_nasdaq.py
test_parse
NasdaqSpiderTest
31
null
eliangcs/pystock-crawler
import cStringIO import os from pystock_crawler import utils from pystock_crawler.tests.base import SAMPLE_DATA_DIR, TestCaseBase class UtilsTest(TestCaseBase): def test_load_symbols(self): try: filename = os.path.join(SAMPLE_DATA_DIR, 'test_symbols.txt') with open(filename, 'w') ...
['AAPL', 'GOOG', 'FB', 'TWTR', 'AMZN', 'SPY', 'YHOO'])
self.assertEqual
collection
pystock_crawler/tests/test_utils.py
test_load_symbols
UtilsTest
48
null
eliangcs/pystock-crawler
import os import tempfile from scrapy.http import HtmlResponse, XmlResponse from pystock_crawler.spiders.edgar import EdgarSpider, URLGenerator from pystock_crawler.tests.base import TestCaseBase def make_url(symbol, start_date='', end_date=''): '''A URL that lists all 10-Q and 10-K filings of a company.''' ...
[ make_url('GOOG'), make_url('ADBE'), make_url('LNKD'), make_url('JPM') ])
self.assertEqual
collection
pystock_crawler/tests/test_spiders_edgar.py
test_symbol_file
EdgarSpiderTest
68
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzoffset, tzutc from brightsky.utils import daytime, parse_date, sunrise_sunset def test_sunrise_sunset(): sunrise, sunset = sunrise_sunset(52, 7.6, datetime.date(2020, 8, 18)) assert sunrise < sunset assert sunrise.utcoffset().total_seconds() ==
0
assert
numeric_literal
tests/test_utils.py
test_sunrise_sunset
20
null
jdemaeyer/brightsky
import base64 import datetime import zlib import numpy as np import pytest from dateutil.tz import tzutc from fastapi.testclient import TestClient import brightsky from brightsky.export import DBExporter, SYNOPExporter from brightsky.parsers import CAPParser, RadarParser from brightsky.query import _warn_cells from b...
v
assert
variable
tests/test_web.py
test_sources_response
247
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc import pytest from brightsky.export import DBExporter, SYNOPExporter SOURCES = [ { 'observation_type': 'historical', 'lat': 10.1, 'lon': 20.2, 'height': 30.3, 'wmo_station_id': '10001', 'dwd_station_id': 'XYZ', ...
RECORDS[2]['timestamp']
assert
complex_expr
tests/test_export.py
test_db_exporter_updates_source_first_last_record
139
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc from brightsky.settings import Settings from .utils import environ def test_settings_parses_environment_bool(): assert isinstance(Settings().KEEP_DOWNLOADS, bool) with environ(BRIGHTSKY_KEEP_DOWNLOADS='0'): assert Settings().KEEP_DOWNLOADS is False w...
True
assert
bool_literal
tests/test_settings.py
test_settings_parses_environment_bool
20
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzoffset, tzutc from brightsky.utils import daytime, parse_date, sunrise_sunset def test_parse_date(): assert parse_date('2020-08-18') == datetime.datetime(2020, 8, 18, 0, 0) assert parse_date('2020-08-18 12:34') ==
datetime.datetime( 2020, 8, 18, 12, 34)
assert
func_call
tests/test_utils.py
test_parse_date
9
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc import pytest from brightsky.export import DBExporter, SYNOPExporter SOURCES = [ { 'observation_type': 'historical', 'lat': 10.1, 'lon': 20.2, 'height': 30.3, 'wmo_station_id': '10001', 'dwd_station_id': 'XYZ', ...
v
assert
variable
tests/test_export.py
test_db_exporter_creates_new_sources
92
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc from brightsky.settings import Settings from .utils import environ def test_settings_parses_environment_bool(): assert isinstance(Settings().KEEP_DOWNLOADS, bool) with environ(BRIGHTSKY_KEEP_DOWNLOADS='0'): assert Settings().KEEP_DOWNLOADS is
False
assert
bool_literal
tests/test_settings.py
test_settings_parses_environment_bool
18
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzoffset, tzutc from brightsky.utils import daytime, parse_date, sunrise_sunset def test_parse_date(): assert parse_date('2020-08-18') == datetime.datetime(2020, 8, 18, 0, 0) assert parse_date('2020-08-18 12:34') == datetime.datetime( 2020, 8, 18, 12, 34) a...
datetime.datetime( 2020, 8, 18, 12, 34, 56, tzinfo=tzoffset(None, 7200))
assert
func_call
tests/test_utils.py
test_parse_date
11
null
jdemaeyer/brightsky
import datetime from unittest.mock import patch from dateutil.tz import tzutc from brightsky.polling import DWDPoller def test_dwdpoller_poll_ignores_parsed_files(db, data_dir): poller = DWDPoller() poller.urls = ['http://example.com/'] url = 'http://example.com/stundenwerte_FF_00011_akt.zip' with op...
len(urls) - 1
assert
func_call
tests/test_polling.py
test_dwdpoller_poll_ignores_parsed_files
78
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzoffset, tzutc from brightsky.utils import daytime, parse_date, sunrise_sunset def test_sunrise_sunset(): sunrise, sunset = sunrise_sunset(52, 7.6, datetime.date(2020, 8, 18)) assert sunrise <
sunset
assert
variable
tests/test_utils.py
test_sunrise_sunset
19
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc from brightsky.export import DBExporter, SYNOPExporter from brightsky.tasks import clean def test_clean_deletes_expired_parsed_files(db): now = datetime.datetime.now(datetime.UTC).replace(tzinfo=tzutc()) fingerprints = [ { 'url': 'https://exam...
2
assert
numeric_literal
tests/test_tasks.py
test_clean_deletes_expired_parsed_files
26
null
jdemaeyer/brightsky
import base64 import datetime import zlib import numpy as np import pytest from dateutil.tz import tzutc from fastapi.testclient import TestClient import brightsky from brightsky.export import DBExporter, SYNOPExporter from brightsky.parsers import CAPParser, RadarParser from brightsky.query import _warn_cells from b...
1
assert
numeric_literal
tests/test_web.py
test_sources_max_dist
260
null
jdemaeyer/brightsky
import datetime import numpy as np from dateutil.tz import tzutc from freezegun import freeze_time from isal import isal_zlib as zlib from brightsky.parsers import ( CloudCoverObservationsParser, CurrentObservationsParser, DewPointObservationsParser, get_parser, MOSMIXParser, PrecipitationObse...
2
assert
numeric_literal
tests/test_parsers.py
test_radar_parser
81
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc from brightsky.settings import Settings from .utils import environ def test_settings_loads_environment(): with environ(BRIGHTSKY_TEST='value'): assert Settings().TEST ==
'value'
assert
string_literal
tests/test_settings.py
test_settings_loads_environment
12
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc from brightsky.settings import Settings from .utils import environ def test_settings_parses_environment_list(): assert isinstance(Settings().CORS_ALLOWED_ORIGINS, list) with environ(BRIGHTSKY_CORS_ALLOWED_ORIGINS=''): assert Settings().CORS_ALLOWED_ORIGI...
['a', 'b', 'c']
assert
collection
tests/test_settings.py
test_settings_parses_environment_list
48
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc from brightsky.export import DBExporter, SYNOPExporter from brightsky.tasks import clean def test_clean_deletes_expired_forecast_current_synop_records(db): now = datetime.datetime.now(datetime.UTC).replace( minute=0, second=0, microsecond=0, tzinfo=tzutc()) ...
5
assert
numeric_literal
tests/test_tasks.py
test_clean_deletes_expired_forecast_current_synop_records
100
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc import pytest from brightsky.export import DBExporter, SYNOPExporter SOURCES = [ { 'observation_type': 'historical', 'lat': 10.1, 'lon': 20.2, 'height': 30.3, 'wmo_station_id': '10001', 'dwd_station_id': 'XYZ', ...
0
assert
numeric_literal
tests/test_export.py
test_synop_exporter
144
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc import pytest from brightsky.export import DBExporter, SYNOPExporter SOURCES = [ { 'observation_type': 'historical', 'lat': 10.1, 'lon': 20.2, 'height': 30.3, 'wmo_station_id': '10001', 'dwd_station_id': 'XYZ', ...
RECORDS[0]['timestamp']
assert
complex_expr
tests/test_export.py
test_db_exporter_updates_source_first_last_record
134
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc from brightsky.settings import Settings from .utils import environ def test_settings_parses_environment_date(): expected = datetime.datetime(2000, 1, 2, tzinfo=tzutc()) assert isinstance(Settings().MIN_DATE, datetime.datetime) with environ(BRIGHTSKY_MIN_DATE...
None
assert
none_literal
tests/test_settings.py
test_settings_parses_environment_date
28
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzoffset, tzutc from brightsky.utils import daytime, parse_date, sunrise_sunset def test_parse_date(): assert parse_date('2020-08-18') ==
datetime.datetime(2020, 8, 18, 0, 0)
assert
func_call
tests/test_utils.py
test_parse_date
8
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc from brightsky.settings import Settings from .utils import environ def test_settings_parses_environment_float(): assert isinstance(Settings().ICON_RAIN_THRESHOLD, float) with environ(BRIGHTSKY_ICON_RAIN_THRESHOLD='0'): assert Settings().ICON_RAIN_THRESH...
float('0')
assert
func_call
tests/test_settings.py
test_settings_parses_environment_float
36
null
jdemaeyer/brightsky
import datetime import numpy as np from dateutil.tz import tzutc from freezegun import freeze_time from isal import isal_zlib as zlib from brightsky.parsers import ( CloudCoverObservationsParser, CurrentObservationsParser, DewPointObservationsParser, get_parser, MOSMIXParser, PrecipitationObse...
datetime.datetime( 2018, 9, 15, 4, tzinfo=tzutc())
assert
func_call
tests/test_parsers.py
test_observations_parser_skips_rows_if_before_cutoff
74
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc import pytest from brightsky.export import DBExporter, SYNOPExporter SOURCES = [ { 'observation_type': 'historical', 'lat': 10.1, 'lon': 20.2, 'height': 30.3, 'wmo_station_id': '10001', 'dwd_station_id': 'XYZ', ...
len(SOURCES[:2])
assert
func_call
tests/test_export.py
test_db_exporter_reuses_existing_sources
98
null
jdemaeyer/brightsky
import datetime from unittest.mock import patch from dateutil.tz import tzutc from brightsky.polling import DWDPoller def test_dwdpoller_poll_ignores_parsed_files(db, data_dir): poller = DWDPoller() poller.urls = ['http://example.com/'] url = 'http://example.com/stundenwerte_FF_00011_akt.zip' with op...
new_urls
assert
variable
tests/test_polling.py
test_dwdpoller_poll_ignores_parsed_files
77
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzoffset, tzutc from brightsky.utils import daytime, parse_date, sunrise_sunset def test_daytime(): midnight_0 = datetime.datetime(2023, 7, 10, 0, 0, tzinfo=tzutc()) noon_0 = datetime.datetime(2023, 7, 10, 12, 0, tzinfo=tzutc()) midnight_10 = datetime.datetime(2023,...
'night'
assert
string_literal
tests/test_utils.py
test_daytime
30
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc import pytest from brightsky.export import DBExporter, SYNOPExporter SOURCES = [ { 'observation_type': 'historical', 'lat': 10.1, 'lon': 20.2, 'height': 30.3, 'wmo_station_id': '10001', 'dwd_station_id': 'XYZ', ...
2
assert
numeric_literal
tests/test_export.py
test_db_exporter_creates_new_sources
89
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc from brightsky.export import DBExporter, SYNOPExporter from brightsky.tasks import clean def test_clean_deletes_expired_forecast_current_synop_records(db): now = datetime.datetime.now(datetime.UTC).replace( minute=0, second=0, microsecond=0, tzinfo=tzutc()) ...
[60., 70.]
assert
collection
tests/test_tasks.py
test_clean_deletes_expired_forecast_current_synop_records
108
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzoffset, tzutc from brightsky.utils import daytime, parse_date, sunrise_sunset def test_daytime(): midnight_0 = datetime.datetime(2023, 7, 10, 0, 0, tzinfo=tzutc()) noon_0 = datetime.datetime(2023, 7, 10, 12, 0, tzinfo=tzutc()) midnight_10 = datetime.datetime(2023,...
'day'
assert
string_literal
tests/test_utils.py
test_daytime
31
null
jdemaeyer/brightsky
import base64 import datetime import zlib import numpy as np import pytest from dateutil.tz import tzutc from fastapi.testclient import TestClient import brightsky from brightsky.export import DBExporter, SYNOPExporter from brightsky.parsers import CAPParser, RadarParser from brightsky.query import _warn_cells from b...
25
assert
numeric_literal
tests/test_web.py
test_weather_response
300
null
jdemaeyer/brightsky
import base64 import datetime import zlib import numpy as np import pytest from dateutil.tz import tzutc from fastapi.testclient import TestClient import brightsky from brightsky.export import DBExporter, SYNOPExporter from brightsky.parsers import CAPParser, RadarParser from brightsky.query import _warn_cells from b...
422
assert
numeric_literal
tests/test_web.py
test_sources_required_parameters
232
null
jdemaeyer/brightsky
import os def test_migrate(db): assert len(db.table('migrations')) ==
len(os.listdir('migrations'))
assert
func_call
tests/test_db.py
test_migrate
5
null
jdemaeyer/brightsky
import base64 import datetime import zlib import numpy as np import pytest from dateutil.tz import tzutc from fastapi.testclient import TestClient import brightsky from brightsky.export import DBExporter, SYNOPExporter from brightsky.parsers import CAPParser, RadarParser from brightsky.query import _warn_cells from b...
2
assert
numeric_literal
tests/test_web.py
test_radar_response
482
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc from brightsky.export import DBExporter, SYNOPExporter from brightsky.tasks import clean def test_clean_deletes_expired_forecast_current_synop_records(db): now = datetime.datetime.now(datetime.UTC).replace( minute=0, second=0, microsecond=0, tzinfo=tzutc()) ...
3
assert
numeric_literal
tests/test_tasks.py
test_clean_deletes_expired_forecast_current_synop_records
101
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc from brightsky.settings import Settings from .utils import environ def test_settings_parses_environment_float(): assert isinstance(Settings().ICON_RAIN_THRESHOLD, float) with environ(BRIGHTSKY_ICON_RAIN_THRESHOLD='0'): assert Settings().ICON_RAIN_THRESHO...
float('1.5')
assert
func_call
tests/test_settings.py
test_settings_parses_environment_float
38
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc import pytest from brightsky.export import DBExporter, SYNOPExporter SOURCES = [ { 'observation_type': 'historical', 'lat': 10.1, 'lon': 20.2, 'height': 30.3, 'wmo_station_id': '10001', 'dwd_station_id': 'XYZ', ...
record['temperature']
assert
complex_expr
tests/test_export.py
test_synop_exporter
165
null
jdemaeyer/brightsky
import datetime import numpy as np from dateutil.tz import tzutc from freezegun import freeze_time from isal import isal_zlib as zlib from brightsky.parsers import ( CloudCoverObservationsParser, CurrentObservationsParser, DewPointObservationsParser, get_parser, MOSMIXParser, PrecipitationObse...
datetime.datetime( 2019, 4, 20, 21, tzinfo=tzutc())
assert
func_call
tests/test_parsers.py
test_observations_parser_skips_rows_if_before_cutoff
67
null
jdemaeyer/brightsky
import datetime import numpy as np from dateutil.tz import tzutc from freezegun import freeze_time from isal import isal_zlib as zlib from brightsky.parsers import ( CloudCoverObservationsParser, CurrentObservationsParser, DewPointObservationsParser, get_parser, MOSMIXParser, PrecipitationObse...
5
assert
numeric_literal
tests/test_parsers.py
test_observations_parser_skips_rows_if_before_cutoff
66
null
jdemaeyer/brightsky
import base64 import datetime import zlib import numpy as np import pytest from dateutil.tz import tzutc from fastapi.testclient import TestClient import brightsky from brightsky.export import DBExporter, SYNOPExporter from brightsky.parsers import CAPParser, RadarParser from brightsky.query import _warn_cells from b...
3
assert
numeric_literal
tests/test_web.py
test_sources_response
244
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc import pytest from brightsky.export import DBExporter, SYNOPExporter SOURCES = [ { 'observation_type': 'historical', 'lat': 10.1, 'lon': 20.2, 'height': 30.3, 'wmo_station_id': '10001', 'dwd_station_id': 'XYZ', ...
record['timestamp']
assert
complex_expr
tests/test_export.py
test_synop_exporter
164
null
jdemaeyer/brightsky
import datetime import numpy as np from dateutil.tz import tzutc from freezegun import freeze_time from isal import isal_zlib as zlib from brightsky.parsers import ( CloudCoverObservationsParser, CurrentObservationsParser, DewPointObservationsParser, get_parser, MOSMIXParser, PrecipitationObse...
len(data)
assert
func_call
tests/test_parsers.py
test_radar_parser
88
null
jdemaeyer/brightsky
import datetime import numpy as np from dateutil.tz import tzutc from freezegun import freeze_time from isal import isal_zlib as zlib from brightsky.parsers import ( CloudCoverObservationsParser, CurrentObservationsParser, DewPointObservationsParser, get_parser, MOSMIXParser, PrecipitationObse...
expected_parser
assert
variable
tests/test_parsers.py
test_get_parser
135
null
jdemaeyer/brightsky
import datetime import numpy as np from dateutil.tz import tzutc from freezegun import freeze_time from isal import isal_zlib as zlib from brightsky.parsers import ( CloudCoverObservationsParser, CurrentObservationsParser, DewPointObservationsParser, get_parser, MOSMIXParser, PrecipitationObse...
source[field]
assert
complex_expr
tests/test_parsers.py
test_current_observation_parser_loads_station_data_from_db
42
null
jdemaeyer/brightsky
import base64 import datetime import zlib import numpy as np import pytest from dateutil.tz import tzutc from fastapi.testclient import TestClient import brightsky from brightsky.export import DBExporter, SYNOPExporter from brightsky.parsers import CAPParser, RadarParser from brightsky.query import _warn_cells from b...
49
assert
numeric_literal
tests/test_web.py
test_weather_date_range
315
null
jdemaeyer/brightsky
import datetime from dateutil.tz import tzutc from brightsky.settings import Settings from .utils import environ def test_settings_parses_environment_date(): expected = datetime.datetime(2000, 1, 2, tzinfo=tzutc()) assert isinstance(Settings().MIN_DATE, datetime.datetime) with environ(BRIGHTSKY_MIN_DATE...
expected
assert
variable
tests/test_settings.py
test_settings_parses_environment_date
27
null
hbldh/bleak
import sys from typing import TYPE_CHECKING import pytest from bumble.device import Device from bleak import BleakClient from bleak.backends import BleakBackend, get_default_backend from tests.integration.conftest import ( configure_and_power_on_bumble_peripheral, find_ble_device, ) async def test_mtu_size(b...
mtu_size
assert
variable
tests/integration/test_client_properties.py
test_mtu_size
62
null
hbldh/bleak
import asyncio import dataclasses import sys from collections.abc import AsyncGenerator import pytest import pytest_asyncio from bumble.att import ATT_Error, ErrorCode from bumble.device import Connection, Device from bumble.gatt import Characteristic, CharacteristicValue, Service from bumble.transport.common import T...
BleakGATTProtocolError)
pytest.raises
variable
tests/integration/test_client_characteristics.py
test_read_gatt_char_error
208
null
hbldh/bleak
import sys import pytest def test_deprecated_OrPattern_import(): with pytest.warns( DeprecationWarning, match="importing OrPattern from bleak.backends.bluezdbus.advertisement_monitor is deprecated", ) as recorder: from bleak.backends.bluezdbus.advertisement_monitor import ( # noqa: F4...
__file__
assert
variable
tests/backends/bluezdbus/test_deprecated_imports.py
test_deprecated_OrPattern_import
20
null
hbldh/bleak
import asyncio import pytest from bumble.device import Device from bleak import BleakClient from bleak._compat import timeout as async_timeout from tests.integration.conftest import ( configure_and_power_on_bumble_peripheral, find_ble_device, ) async def test_is_connected(bumble_peripheral: Device): """C...
True
assert
bool_literal
tests/integration/test_client_connecting.py
test_is_connected
62
null
hbldh/bleak
import asyncio import dataclasses import sys from collections.abc import AsyncGenerator import pytest import pytest_asyncio from bumble.att import ATT_Error, ErrorCode from bumble.device import Connection, Device from bumble.gatt import Characteristic, CharacteristicValue, Service from bumble.transport.common import T...
b"ORIGINAL"
assert
string_literal
tests/integration/test_client_characteristics.py
test_read_gatt_char_use_cached
182
null
hbldh/bleak
import platform import pytest from bleak import BleakClient, BleakScanner from bleak.backends import BleakBackend from bleak.backends.client import get_platform_client_backend_type from bleak.backends.scanner import get_platform_scanner_backend_type @pytest.mark.asyncio async def test_backend_id(): """Test that ...
BleakBackend.WIN_RT
assert
complex_expr
tests/test_platform_detection.py
test_backend_id
50
null
hbldh/bleak
import sys import pytest import gc import weakref from unittest.mock import Mock from bumble.device import Device from CoreBluetooth import ( CBManagerAuthorizationDenied, CBManagerAuthorizationRestricted, CBManagerStatePoweredOff, CBManagerStateResetting, CBManagerStateUnauthorized, CBManage...
expected_reason
assert
variable
tests/integration/test_quirks_corebluetooth.py
test_bluetooth_availability
148
null
hbldh/bleak
import dataclasses import sys from collections.abc import AsyncGenerator import pytest import pytest_asyncio from bumble import gatt from bumble.att import ATT_Error, AttributeValue, ErrorCode from bumble.core import UUID from bumble.device import Connection, Device from bumble.gatt import Characteristic, Descriptor, ...
b"Original"
assert
string_literal
tests/integration/test_client_descriptors.py
test_read_gatt_descriptor_use_cached
298
null
hbldh/bleak
import asyncio import contextlib import sys import pytest from bumble import data_types from bumble.core import UUID from bumble.device import Device from bleak import BleakScanner from bleak.backends.device import BLEDevice from bleak.backends.scanner import AdvertisementData from bleak.uuids import normalize_uuid_s...
123
assert
numeric_literal
tests/integration/test_scanner.py
test_adv_data_complex
146
null
hbldh/bleak
import asyncio import pytest from bumble.device import Device from bleak import BleakClient from bleak._compat import timeout as async_timeout from tests.integration.conftest import ( configure_and_power_on_bumble_peripheral, find_ble_device, ) async def test_connect(bumble_peripheral: Device): """Connec...
bumble_peripheral.name
assert
complex_expr
tests/integration/test_client_connecting.py
test_connect
21
null
hbldh/bleak
import asyncio import contextlib import sys import pytest from bumble import data_types from bumble.core import UUID from bumble.device import Device from bleak import BleakScanner from bleak.backends.device import BLEDevice from bleak.backends.scanner import AdvertisementData from bleak.uuids import normalize_uuid_s...
{}
assert
collection
tests/integration/test_scanner.py
test_adv_data_simple
102
null
hbldh/bleak
import asyncio import contextlib import sys import pytest from bumble import data_types from bumble.core import UUID from bumble.device import Device from bleak import BleakScanner from bleak.backends.device import BLEDevice from bleak.backends.scanner import AdvertisementData from bleak.uuids import normalize_uuid_s...
None
assert
none_literal
tests/integration/test_scanner.py
test_find_by_address
45
null
hbldh/bleak
import sys import pytest def test_device_path_from_characteristic_path(): """Test device_path_from_characteristic_path.""" from bleak.backends.bluezdbus.utils import ( # pylint: disable=import-outside-toplevel device_path_from_characteristic_path, ) assert
"/org/bluez/hci0/dev_11_22_33_44_55_66"
assert
string_literal
tests/backends/bluezdbus/test_utils.py
test_device_path_from_characteristic_path
20
null
hbldh/bleak
import asyncio import contextlib import sys import pytest from bumble import data_types from bumble.core import UUID from bumble.device import Device from bleak import BleakScanner from bleak.backends.device import BLEDevice from bleak.backends.scanner import AdvertisementData from bleak.uuids import normalize_uuid_s...
1
assert
numeric_literal
tests/integration/test_scanner.py
test_discover
31
null
hbldh/bleak
import sys import pytest import gc import weakref from unittest.mock import Mock from bumble.device import Device from CoreBluetooth import ( CBManagerAuthorizationDenied, CBManagerAuthorizationRestricted, CBManagerStatePoweredOff, CBManagerStateResetting, CBManagerStateUnauthorized, CBManage...
None
assert
none_literal
tests/integration/test_quirks_corebluetooth.py
get_peripheral_delegate
60
null
hbldh/bleak
import dataclasses import sys from collections.abc import AsyncGenerator import pytest import pytest_asyncio from bumble import gatt from bumble.att import ATT_Error, AttributeValue, ErrorCode from bumble.core import UUID from bumble.device import Connection, Device from bumble.gatt import Characteristic, Descriptor, ...
ValueError, match="Cannot write to CCCD")
pytest.raises
complex_expr
tests/integration/test_client_descriptors.py
test_write_gatt_descriptor
385
null
hbldh/bleak
import platform import pytest from bleak import BleakClient, BleakScanner from bleak.backends import BleakBackend from bleak.backends.client import get_platform_client_backend_type from bleak.backends.scanner import get_platform_scanner_backend_type def test_platform_detection(): """Test by importing the client ...
"BleakClientBlueZDBus"
assert
string_literal
tests/test_platform_detection.py
test_platform_detection
22
null
hbldh/bleak
import dataclasses import sys from collections.abc import AsyncGenerator import pytest import pytest_asyncio from bumble import gatt from bumble.att import ATT_Error, AttributeValue, ErrorCode from bumble.core import UUID from bumble.device import Connection, Device from bumble.gatt import Characteristic, Descriptor, ...
BleakGATTProtocolError)
pytest.raises
variable
tests/integration/test_client_descriptors.py
test_read_gatt_descriptor_error
345
null
hbldh/bleak
from bleak.uuids import normalize_uuid_16, normalize_uuid_32, normalize_uuid_str def test_uuid_32_normalization(): assert normalize_uuid_32(0x12345678) ==
"12345678-0000-1000-8000-00805f9b34fb"
assert
string_literal
tests/test_uuid.py
test_uuid_32_normalization
22
null
hbldh/bleak
import asyncio import dataclasses import sys from collections.abc import AsyncGenerator import pytest import pytest_asyncio from bumble.att import ATT_Error, ErrorCode from bumble.device import Connection, Device from bumble.gatt import Characteristic, CharacteristicValue, Service from bumble.transport.common import T...
asyncio.TimeoutError)
pytest.raises
complex_expr
tests/integration/test_client_characteristics.py
test_notify_gatt_char
319
null
hbldh/bleak
import sys import pytest import gc import weakref from unittest.mock import Mock from bumble.device import Device from CoreBluetooth import ( CBManagerAuthorizationDenied, CBManagerAuthorizationRestricted, CBManagerStatePoweredOff, CBManagerStateResetting, CBManagerStateUnauthorized, CBManage...
BleakBluetoothNotAvailableError, match=expected_msg)
pytest.raises
complex_expr
tests/integration/test_quirks_corebluetooth.py
test_bluetooth_availability
144
null
hbldh/bleak
import dataclasses import sys from collections.abc import AsyncGenerator import pytest import pytest_asyncio from bumble import gatt from bumble.att import ATT_Error, AttributeValue, ErrorCode from bumble.core import UUID from bumble.device import Connection, Device from bumble.gatt import Characteristic, Descriptor, ...
descr_data
assert
variable
tests/integration/test_client_descriptors.py
test_read_gatt_descriptor
270
null
hbldh/bleak
import asyncio import dataclasses import sys from collections.abc import AsyncGenerator import pytest import pytest_asyncio from bumble.att import ATT_Error, ErrorCode from bumble.device import Connection, Device from bumble.gatt import Characteristic, CharacteristicValue, Service from bumble.transport.common import T...
b"DATA"
assert
string_literal
tests/integration/test_client_characteristics.py
test_read_gatt_char
163
null
hbldh/bleak
import platform import pytest from bleak import BleakClient, BleakScanner from bleak.backends import BleakBackend from bleak.backends.client import get_platform_client_backend_type from bleak.backends.scanner import get_platform_scanner_backend_type @pytest.mark.asyncio async def test_backend_id(): """Test that ...
BleakBackend.BLUEZ_DBUS
assert
complex_expr
tests/test_platform_detection.py
test_backend_id
47
null
hbldh/bleak
import asyncio import dataclasses import sys from collections.abc import AsyncGenerator import pytest import pytest_asyncio from bumble.att import ATT_Error, ErrorCode from bumble.device import Connection, Device from bumble.gatt import Characteristic, CharacteristicValue, Service from bumble.transport.common import T...
gatt_error
assert
variable
tests/integration/test_client_characteristics.py
test_read_gatt_char_error
211
null
hbldh/bleak
import platform import pytest from bleak import BleakClient, BleakScanner from bleak.backends import BleakBackend from bleak.backends.client import get_platform_client_backend_type from bleak.backends.scanner import get_platform_scanner_backend_type @pytest.mark.asyncio async def test_backend_id(): """Test that ...
scanner.backend_id
assert
complex_expr
tests/test_platform_detection.py
test_backend_id
44
null
hbldh/bleak
import asyncio import pytest from bumble.device import Device from bleak import BleakClient from bleak._compat import timeout as async_timeout from tests.integration.conftest import ( configure_and_power_on_bumble_peripheral, find_ble_device, ) async def test_disconnect_callback(bumble_peripheral: Device): ...
client
assert
variable
tests/integration/test_client_connecting.py
test_disconnect_callback
85
null
hbldh/bleak
import sys from typing import TYPE_CHECKING import pytest from bumble.device import Device from bleak import BleakClient from bleak.backends import BleakBackend, get_default_backend from tests.integration.conftest import ( configure_and_power_on_bumble_peripheral, find_ble_device, ) @pytest.mark.skipif( ...
rssi
assert
variable
tests/integration/test_client_properties.py
test_get_rssi
40
null
hbldh/bleak
import asyncio from bumble.att import Attribute, AttributeValue from bumble.device import Connection, Device from bumble.gatt import ( GATT_CLIENT_CHARACTERISTIC_CONFIGURATION_DESCRIPTOR, Characteristic, Descriptor, Service, ) from bleak import BleakClient from bleak.backends.characteristic import Ble...
b"test"
assert
string_literal
tests/integration/test_issue_1885.py
test_notification_sent_before_write_response
84
null