Best Python code snippet using prospector_python
setup.py
Source:setup.py
...6# To use a consistent encoding7from codecs import open8from os import path9from os import listdir10def expand_files(d):11 files_list = [path.join(d, f) for f in listdir(d) if path.isfile(path.join(d, f))]12 return files_list13here = path.abspath(path.dirname(__file__))14# Get the long description from the relevant file15with open(path.join(here, 'DESCRIPTION.rst'), encoding='utf-8') as f:16 long_description = f.read()17setup(18 name='jim',19 # Versions should comply with PEP440. For a discussion on single-sourcing20 # the version across setup.py and the project code, see21 # https://packaging.python.org/en/latest/single_source_version.html22 version='2.0.0',23 description='JIm = Jim Improved, Score Processing System for ATTTC Club',24 long_description=long_description,25 url='http://bitbucket.com/tbd',26 author='Ilija Hadzic',27 author_email='ilijahadzic@gmail.com',28 license='MIT',29 # See https://pypi.python.org/pypi?%3Aaction=list_classifiers30 classifiers=[31 'Development Status :: 3 - Alpha',32 'Intended Audience :: Tennis Players',33 'Topic :: Applications :: Web',34 'License :: OSI Approved :: MIT License',35 'Programming Language :: Python :: 2',36 'Programming Language :: Python :: 2.6',37 'Programming Language :: Python :: 2.7'38 ],39 keywords='tennis rankings competition database web',40 packages=find_packages(exclude=[]),41 install_requires=['tornado', 'bcrypt', 'python-daemon', 'argparse'],42 package_data={43 'jim': ['jim.cfg']44 },45 data_files=[46 ('var/jim/html', expand_files('html')),47 ('var/jim/html/js', expand_files('html/js')),48 ('var/jim/html/css', expand_files('html/css')),49 ('var/jim/templates', expand_files('templates')),50 ('var/jim/certs', expand_files('certs'))51 ],52 entry_points={53 'console_scripts': [54 'jim=jim:main',55 ],56 },...
test_utils.py
Source:test_utils.py
...18 assert wildcard_filter(x, 'a?') == ['ab']19 assert wildcard_filter(x, [['a*'], 'b']) == x20 assert wildcard_filter(x, ['*a', '*b']) == x21 assert wildcard_filter(x, ['a', 'b']) == ['a', 'b']22def test_expand_files():23 from pathlib import Path24 from pachypy.utils import expand_files25 mock_dir = lambda glob: os.path.join(os.path.dirname(__file__), 'mock', glob)26 assert len(expand_files(None)) == 027 assert len(expand_files(mock_dir('*.csv'))) == 728 assert len(expand_files(Path(mock_dir('*.csv')))) == 729 assert len(expand_files([mock_dir('list_*.csv'), Path(mock_dir('get_*.csv'))])) == 730def test_invert_dict():31 from pachypy.utils import invert_dict32 assert invert_dict({'a': '1'}) == {'1': ['a']}33 assert invert_dict({'a': '1', 'b': '1'}) == {'1': ['a', 'b']}34 assert invert_dict({'a': '1', 'b': '2'}) == {'1': ['a'], '2': ['b']}35def test_to_timestamp():36 from pachypy.utils import to_timestamp37 assert to_timestamp(0, 0) is None38 assert to_timestamp(1554878996, 0) == pd.Timestamp('2019-04-10 06:49:56', tz='utc')39def test_to_timedelta():40 from pachypy.utils import to_timedelta41 assert to_timedelta(0, 0) == pd.Timedelta(0, unit='s')...
test_io.py
Source:test_io.py
...5 expand_files,6 read_sql_file,7 get_expect_file,8)9def test_expand_files():10 files = expand_files([Path("checks/basic"), Path("checks/failing")])11 assert len(files) >= 312def test_expand_files_csv():13 files = expand_files([Path("load_data")], extension=".csv")14 assert len(files) >= 315def test_expand_files_empty():16 files = expand_files([Path("load_data")], extension=".sql")17 assert len(files) == 018def test_expand_files_not_existing():19 with pytest.raises(Exception) as e:20 expand_files([Path("checks/non_existing")])21 assert str(e.value) == f"unexpected path: checks{os.sep}non_existing"22def test_read_sql_file_with_template():23 text = read_sql_file(Path("checks/templates/template1.sql"), {})24 assert "{{" not in text25def test_get_expect_file():26 ef = get_expect_file(Path("test_file.sql"))27 assert ef == Path("test_file.csv")28def test_get_expect_file_null():29 p = Path()30 ef = get_expect_file(p)31 assert ef == Path()32def test_get_expect_file_empty():33 p = Path("")34 ef = get_expect_file(p)...
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!