示例#1
0
 def check_file(self, filename: str, mode: black.Mode, *, data: bool = True) -> None:
     source, expected = read_data(filename, data=data)
     actual = fs(source, mode=mode)
     self.assertFormatEqual(expected, actual)
     if source != actual:
         black.assert_equivalent(source, actual)
         black.assert_stable(source, actual, mode)
示例#2
0
def test_patma_invalid() -> None:
    source, expected = read_data("pattern_matching_invalid")
    mode = black.Mode(target_versions={black.TargetVersion.PY310})
    with pytest.raises(black.parsing.InvalidInput) as exc_info:
        assert_format(source, expected, mode, minimum_version=(3, 10))

    exc_info.match("Cannot parse: 10:11")
示例#3
0
文件: test_blackd.py 项目: jap/blacq
    async def test_blackd_diff(self) -> None:
        diff_header = re.compile(
            r'(In|Out)\t\d\d\d\d-\d\d-\d\d \d\d:\d\d:\d\d\.\d\d\d\d\d\d \+\d\d\d\d'
        )

        source, _ = read_data('blackd_diff.py')
        expected, _ = read_data('blackd_diff.diff')

        response = await self.client.post('/',
                                          data=source,
                                          headers={blackd.DIFF_HEADER: 'true'})
        self.assertEqual(response.status, 200)

        actual = await response.text()
        actual = diff_header.sub(DETERMINISTIC_HEADER, actual)
        self.assertEqual(actual, expected)
示例#4
0
    def check_file(self,
                   filename: str,
                   mode: black.Mode,
                   kwargs: dict,
                   *,
                   data: bool = True) -> None:
        source, expected = read_data(filename, data=data)

        result: Result

        with TemporaryPathPlus() as tmp_pathplus:
            (tmp_pathplus / filename).write_text(source)
            toml_data = dom_toml.load(
                PathPlus(__file__).parent / "example_formate.toml")
            toml_data["hooks"]["black"]["kwargs"] = kwargs
            dom_toml.dump(toml_data, tmp_pathplus / "formate.toml")

            with in_directory(tmp_pathplus):
                runner = CliRunner(mix_stderr=False)
                result = runner.invoke(
                    main,
                    args=[
                        filename, "--no-colour", "--diff", "--verbose", "-v"
                    ],
                )

            # TODO: check stdout
            actual = (tmp_pathplus / filename).read_text()

        self.assertFormatEqual(expected, actual)
        if source != actual:
            black.assert_equivalent(source, actual)
            black.assert_stable(source, actual, mode)
示例#5
0
 async def test_blackd_pyi(self) -> None:
     source, expected = read_data("stub.pyi")
     response = await self.client.post(
         "/", data=source, headers={blackd.PYTHON_VARIANT_HEADER: "pyi"}
     )
     self.assertEqual(response.status, 200)
     self.assertEqual(await response.text(), expected)
示例#6
0
def test_patma_hint() -> None:
    source, expected = read_data("pattern_matching_simple")
    mode = black.Mode(target_versions={black.TargetVersion.PY39})
    with pytest.raises(black.parsing.InvalidInput) as exc_info:
        assert_format(source, expected, mode, minimum_version=(3, 10))

    exc_info.match(black.parsing.PY310_HINT)
示例#7
0
 def test_source_is_formatted(self, filename: str) -> None:
     path = THIS_DIR.parent / filename
     source, expected = read_data(str(path), data=False)
     actual = fs(source, mode=DEFAULT_MODE)
     self.assertFormatEqual(expected, actual)
     black.assert_equivalent(source, actual)
     black.assert_stable(source, actual, DEFAULT_MODE)
     self.assertFalse(ff(path))
示例#8
0
def test_remove_with_brackets() -> None:
    source, expected = read_data("remove_with_brackets")
    assert_format(
        source,
        expected,
        black.Mode(preview=True),
        minimum_version=(3, 9),
    )
def test_python39() -> None:
	source_path = (THIS_DIR / "data" / "python39.py").resolve()
	source, expected = read_data("python39")
	actual = black_hook(source, formate_filename=source_path)
	assert expected == actual

	major, minor = sys.version_info[:2]
	if major > 3 or (major == 3 and minor >= 9):
		black.assert_equivalent(source, actual)

	black.assert_stable(source, actual, DEFAULT_MODE)
def test_async_as_identifier() -> None:
	source_path = (THIS_DIR / "data" / "async_as_identifier.py").resolve()
	source, expected = read_data("async_as_identifier")
	actual = black_hook(source, formate_filename=source_path)
	assert expected == actual

	major, minor = sys.version_info[:2]
	if major < 3 or (major <= 3 and minor < 7):
		black.assert_equivalent(source, actual)

	black.assert_stable(source, actual, DEFAULT_MODE)

	# ensure black can parse this when the target is 3.6
	black_hook(source, formate_filename=source_path, target_version="py36")

	# but not on 3.7, because async/await is no longer an identifier
	with pytest.raises(InvalidInput, match="Cannot parse: 1:4: def async()"):
		black_hook(source, formate_filename=source_path, target_version="py37")
示例#11
0
 def test_search_results(self):
     res = util.read_data('dan_bull_search.html')
     actual = pirate.torrent.parse_page(res)
     expected = [
         {'uploaded': '04-04\xa02014', 'seeds': '16', 'leechers': '1', 'id': '9890864', 'magnet': 'magnet:?xt=urn:btih:30df4f8b42b8fd77f5e5aa34abbffe97f5e81fbf&dn=Dan+Croll+%26bull%3B+Sweet+Disarray+%5B2014%5D+320&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['89.33', 'MiB']},
         {'uploaded': '03-02\xa02014', 'seeds': '4', 'leechers': '0', 'id': '9684858', 'magnet': 'magnet:?xt=urn:btih:7abd3eda600996b8e6fc9a61b83288e0c6ac0d83&dn=Dan+Bull+-+Massive+Collection&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['294', 'MiB']},
         {'uploaded': '01-19\xa02013', 'seeds': '2', 'leechers': '0', 'id': '8037968', 'magnet': 'magnet:?xt=urn:btih:8f8d68fd0a51237c89692c428ed8a8f64a969c70&dn=Dan+Bull+-+Generation+Gaming+-+2013&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['54.86', 'MiB']},
         {'uploaded': '01-21\xa02010', 'seeds': '1', 'leechers': '0', 'id': '5295449', 'magnet': 'magnet:?xt=urn:btih:3da6a0fdc1d67a768cb32597e926abdf3e1a2fdd&dn=Dan+Bull+Collection&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['236.78', 'MiB']},
         {'uploaded': '09-02\xa02014', 'seeds': '1', 'leechers': '0', 'id': '10954408', 'magnet': 'magnet:?xt=urn:btih:5cd371a235317319db7da52c64422f9c2ac75d77&dn=Dan+Bull+-+The+Garden+%7B2014-Album%7D&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['36.27', 'MiB']},
         {'uploaded': '09-27\xa02009', 'seeds': '0', 'leechers': '1', 'id': '5101630', 'magnet': 'magnet:?xt=urn:btih:4e14dbd077c920875be4c15971b23b609ad6716a&dn=Dan+Bull+-+Dear+Lily+%5Ban+open+letter+to+Lily+Allen%5D+-+2009%5BMP3+%40&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['5.51', 'MiB']},
         {'uploaded': '11-29\xa02009', 'seeds': '0', 'leechers': '0', 'id': '5185893', 'magnet': 'magnet:?xt=urn:btih:5d9319cf852f7462422cb1bffc37b65174645047&dn=Dan+Bull+-+Dear+Mandy+%5Ban+open+letter+to+Lord+Mandelson%5D&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['5.07', 'MiB']},
         {'uploaded': '11-10\xa02011', 'seeds': '0', 'leechers': '0', 'id': '6806996', 'magnet': 'magnet:?xt=urn:btih:1c54af57426f53fdef4bbf1a9dbddf32f7b4988a&dn=Dan+Bull+-+Dear+Lily+%28Lily+Allen%29+%28Song+about+filesharing%29&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['5.34', 'MiB']},
         {'uploaded': '12-20\xa02011', 'seeds': '0', 'leechers': '0', 'id': '6901871', 'magnet': 'magnet:?xt=urn:btih:942c5bf3e1e9bc263939e13cea6ad7bd5f62aa36&dn=Dan+Bull+-+SOPA+Cabana.mp3&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['4.8', 'MiB']},
         {'uploaded': '12-21\xa02011', 'seeds': '0', 'leechers': '1', 'id': '6902247', 'magnet': 'magnet:?xt=urn:btih:d376f68a31b0db652234e790ed7256ac5e32db57&dn=Dan+Bull+-+SOPA+Cabana&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['3.4', 'MiB']},
         {'uploaded': '12-21\xa02011', 'seeds': '0', 'leechers': '1', 'id': '6903548', 'magnet': 'magnet:?xt=urn:btih:28163770a532eb24b9e0865878288a9bbdb7a5e6&dn=Dan+Bull+-+SOPA+Cabana+%5BWORKING%5D&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['4.8', 'MiB']},
         {'uploaded': '03-09\xa02012', 'seeds': '0', 'leechers': '1', 'id': '7088979', 'magnet': 'magnet:?xt=urn:btih:779ab0f13a3fbb12ba68b27721491e4d143f26eb&dn=Dan+Bull+-+Bye+Bye+BPI+2012++%5BMP3%40192%5D%28oan%29&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['60.72', 'MiB']},
         {'uploaded': '10-24\xa02012', 'seeds': '0', 'leechers': '0', 'id': '7756344', 'magnet': 'magnet:?xt=urn:btih:2667e4795bd5c868dedcabcb52943f4bb7212bab&dn=Dan+Bull+-+Dishonored+%5BExplicit+ver.%5D+%28Single+2012%29&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['6.29', 'MiB']},
         {'uploaded': '11-10\xa02012', 'seeds': '0', 'leechers': '0', 'id': '7812951', 'magnet': 'magnet:?xt=urn:btih:16364f83c556ad0fd3bb57a4a7c890e7e8087414&dn=Halo+4+EPIC+Rap+By+Dan+Bull&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['6.41', 'MiB']},
         {'uploaded': '01-19\xa02013', 'seeds': '0', 'leechers': '1', 'id': '8037899', 'magnet': 'magnet:?xt=urn:btih:843b466d9fd1f0bee3a476573b272dc2d6d0ebae&dn=Dan+Bull+-+Generation+Gaming+-+2013&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969', 'size': ['54.87', 'MiB']}
     ]
     self.assertEqual(actual, expected)
def test_python37() -> None:
	source_path = (THIS_DIR / "data" / "python37.py").resolve()
	source, expected = read_data("python37")
	actual = black_hook(source, formate_filename=source_path)
	assert expected == actual

	major, minor = sys.version_info[:2]
	if major < 3 or (major <= 3 and minor < 7):
		black.assert_equivalent(source, actual)

	black.assert_stable(source, actual, DEFAULT_MODE)

	# ensure black can parse this when the target is 3.7
	black_hook(source, formate_filename=source_path, target_version="py37")

	# but not on 3.6, because we use async as a reserved keyword
	with pytest.raises(
			InvalidInput,
			match=re.escape("Cannot parse: 26:18:     return (await awaitable for awaitable in awaitable_list)"),
			):
		black_hook(source, formate_filename=source_path, target_version="py36")
示例#13
0
def test_python_310_without_target_version() -> None:
    source, expected = read_data("pattern_matching_simple")
    mode = black.Mode()
    assert_format(source, expected, mode, minimum_version=(3, 10))
示例#14
0
def test_line_length_tabs() -> None:
    source, expected = read_data("line_length_tabs")
    assert_format(source,
                  expected,
                  mode=black.Mode(line_length=20, use_tabs=True))
示例#15
0
def test_pep_570() -> None:
    source, expected = read_data("pep_570")
    assert_format(source, expected, minimum_version=(3, 8))
示例#16
0
def test_python_310(filename: str) -> None:
    source, expected = read_data(filename)
    mode = black.Mode(target_versions={black.TargetVersion.PY310})
    assert_format(source, expected, mode, minimum_version=(3, 10))
示例#17
0
def test_python2_print_function() -> None:
    source, expected = read_data("python2_print_function")
    mode = replace(DEFAULT_MODE, target_versions={black.TargetVersion.PY27})
    assert_format(source, expected, mode)
示例#18
0
def test_pep_572_newer_syntax(major: int, minor: int) -> None:
    source, expected = read_data(f"pep_572_py{major}{minor}")
    assert_format(source, expected, minimum_version=(major, minor))
示例#19
0
def check_file(filename: str, mode: black.Mode, *, data: bool = True) -> None:
    source, expected = read_data(filename, data=data)
    assert_format(source, expected, mode, fast=False)
示例#20
0
def test_numeric_literals_ignoring_underscores() -> None:
    source, expected = read_data("numeric_literals_skip_underscores")
    mode = replace(DEFAULT_MODE, target_versions=PY36_VERSIONS)
    assert_format(source, expected, mode)
示例#21
0
 def test_blocked_mirror(self):
     res = util.read_data('blocked.html')
     with self.assertRaises(IOError):
         pirate.torrent.parse_page(res)
示例#22
0
 def test_no_hits(self):
     res = util.read_data('no_hits.html')
     actual = pirate.torrent.parse_page(res)
     expected = []
     self.assertEqual(actual, expected)
示例#23
0
 def test_no_hits(self):
     res = util.read_data('no_hits.html')
     actual = pirate.torrent.parse_page(res)
     expected = []
     self.assertEqual(actual, expected)
示例#24
0
def test_python39() -> None:
    source, expected = read_data("python39")
    assert_format(source, expected, minimum_version=(3, 9))
示例#25
0
 def test_blocked_mirror(self):
     res = util.read_data('blocked.html')
     with self.assertRaises(IOError):
         pirate.torrent.parse_page(res)
示例#26
0
def test_docstring_no_string_normalization() -> None:
    """Like test_docstring but with string normalization off."""
    source, expected = read_data("docstring_no_string_normalization")
    mode = replace(DEFAULT_MODE, string_normalization=False)
    assert_format(source, expected, mode)
示例#27
0
def test_pep_572_remove_parens() -> None:
    source, expected = read_data("pep_572_remove_parens")
    assert_format(source, expected, minimum_version=(3, 8))
示例#28
0
def test_long_strings_flag_disabled() -> None:
    """Tests for turning off the string processing logic."""
    source, expected = read_data("long_strings_flag_disabled")
    mode = replace(DEFAULT_MODE, experimental_string_processing=False)
    assert_format(source, expected, mode)
示例#29
0
def test_pep_572_do_not_remove_parens() -> None:
    source, expected = read_data("pep_572_do_not_remove_parens")
    # the AST safety checks will fail, but that's expected, just make sure no
    # parentheses are touched
    assert_format(source, expected, fast=True)
示例#30
0
def test_stub() -> None:
    mode = replace(DEFAULT_MODE, is_pyi=True)
    source, expected = read_data("stub.pyi")
    assert_format(source, expected, mode)
示例#31
0
 def test_search_results(self):
     res = util.read_data('dan_bull_search.html')
     actual = pirate.torrent.parse_page(res)
     expected = [{
         'uploaded': '04-04\xa02014',
         'seeds': '16',
         'leechers': '1',
         'id': '9890864',
         'magnet':
         'magnet:?xt=urn:btih:30df4f8b42b8fd77f5e5aa34abbffe97f5e81fbf&dn=Dan+Croll+%26bull%3B+Sweet+Disarray+%5B2014%5D+320&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['89.33', 'MiB']
     }, {
         'uploaded': '03-02\xa02014',
         'seeds': '4',
         'leechers': '0',
         'id': '9684858',
         'magnet':
         'magnet:?xt=urn:btih:7abd3eda600996b8e6fc9a61b83288e0c6ac0d83&dn=Dan+Bull+-+Massive+Collection&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['294', 'MiB']
     }, {
         'uploaded': '01-19\xa02013',
         'seeds': '2',
         'leechers': '0',
         'id': '8037968',
         'magnet':
         'magnet:?xt=urn:btih:8f8d68fd0a51237c89692c428ed8a8f64a969c70&dn=Dan+Bull+-+Generation+Gaming+-+2013&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['54.86', 'MiB']
     }, {
         'uploaded': '01-21\xa02010',
         'seeds': '1',
         'leechers': '0',
         'id': '5295449',
         'magnet':
         'magnet:?xt=urn:btih:3da6a0fdc1d67a768cb32597e926abdf3e1a2fdd&dn=Dan+Bull+Collection&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['236.78', 'MiB']
     }, {
         'uploaded': '09-02\xa02014',
         'seeds': '1',
         'leechers': '0',
         'id': '10954408',
         'magnet':
         'magnet:?xt=urn:btih:5cd371a235317319db7da52c64422f9c2ac75d77&dn=Dan+Bull+-+The+Garden+%7B2014-Album%7D&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['36.27', 'MiB']
     }, {
         'uploaded': '09-27\xa02009',
         'seeds': '0',
         'leechers': '1',
         'id': '5101630',
         'magnet':
         'magnet:?xt=urn:btih:4e14dbd077c920875be4c15971b23b609ad6716a&dn=Dan+Bull+-+Dear+Lily+%5Ban+open+letter+to+Lily+Allen%5D+-+2009%5BMP3+%40&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['5.51', 'MiB']
     }, {
         'uploaded': '11-29\xa02009',
         'seeds': '0',
         'leechers': '0',
         'id': '5185893',
         'magnet':
         'magnet:?xt=urn:btih:5d9319cf852f7462422cb1bffc37b65174645047&dn=Dan+Bull+-+Dear+Mandy+%5Ban+open+letter+to+Lord+Mandelson%5D&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['5.07', 'MiB']
     }, {
         'uploaded': '11-10\xa02011',
         'seeds': '0',
         'leechers': '0',
         'id': '6806996',
         'magnet':
         'magnet:?xt=urn:btih:1c54af57426f53fdef4bbf1a9dbddf32f7b4988a&dn=Dan+Bull+-+Dear+Lily+%28Lily+Allen%29+%28Song+about+filesharing%29&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['5.34', 'MiB']
     }, {
         'uploaded': '12-20\xa02011',
         'seeds': '0',
         'leechers': '0',
         'id': '6901871',
         'magnet':
         'magnet:?xt=urn:btih:942c5bf3e1e9bc263939e13cea6ad7bd5f62aa36&dn=Dan+Bull+-+SOPA+Cabana.mp3&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['4.8', 'MiB']
     }, {
         'uploaded': '12-21\xa02011',
         'seeds': '0',
         'leechers': '1',
         'id': '6902247',
         'magnet':
         'magnet:?xt=urn:btih:d376f68a31b0db652234e790ed7256ac5e32db57&dn=Dan+Bull+-+SOPA+Cabana&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['3.4', 'MiB']
     }, {
         'uploaded': '12-21\xa02011',
         'seeds': '0',
         'leechers': '1',
         'id': '6903548',
         'magnet':
         'magnet:?xt=urn:btih:28163770a532eb24b9e0865878288a9bbdb7a5e6&dn=Dan+Bull+-+SOPA+Cabana+%5BWORKING%5D&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['4.8', 'MiB']
     }, {
         'uploaded': '03-09\xa02012',
         'seeds': '0',
         'leechers': '1',
         'id': '7088979',
         'magnet':
         'magnet:?xt=urn:btih:779ab0f13a3fbb12ba68b27721491e4d143f26eb&dn=Dan+Bull+-+Bye+Bye+BPI+2012++%5BMP3%40192%5D%28oan%29&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['60.72', 'MiB']
     }, {
         'uploaded': '10-24\xa02012',
         'seeds': '0',
         'leechers': '0',
         'id': '7756344',
         'magnet':
         'magnet:?xt=urn:btih:2667e4795bd5c868dedcabcb52943f4bb7212bab&dn=Dan+Bull+-+Dishonored+%5BExplicit+ver.%5D+%28Single+2012%29&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['6.29', 'MiB']
     }, {
         'uploaded': '11-10\xa02012',
         'seeds': '0',
         'leechers': '0',
         'id': '7812951',
         'magnet':
         'magnet:?xt=urn:btih:16364f83c556ad0fd3bb57a4a7c890e7e8087414&dn=Halo+4+EPIC+Rap+By+Dan+Bull&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['6.41', 'MiB']
     }, {
         'uploaded': '01-19\xa02013',
         'seeds': '0',
         'leechers': '1',
         'id': '8037899',
         'magnet':
         'magnet:?xt=urn:btih:843b466d9fd1f0bee3a476573b272dc2d6d0ebae&dn=Dan+Bull+-+Generation+Gaming+-+2013&tr=udp%3A%2F%2Ftracker.openbittorrent.com%3A80&tr=udp%3A%2F%2Fopen.demonii.com%3A1337&tr=udp%3A%2F%2Ftracker.coppersurfer.tk%3A6969&tr=udp%3A%2F%2Fexodus.desync.com%3A6969',
         'size': ['54.87', 'MiB']
     }]
     self.assertEqual(actual, expected)
示例#32
0
def test_power_op_newline() -> None:
    # requires line_length=0
    source, expected = read_data("power_op_newline")
    assert_format(source, expected, mode=black.Mode(line_length=0))
def test_line_length_global(advanced_file_regression: AdvancedFileRegressionFixture, length: int) -> None:
	source_path = (THIS_DIR / "data" / "long_strings.py").resolve()
	source, expected = read_data("long_strings")

	actual = black_hook(source, formate_filename=source_path, formate_global_config={"line_length": length})
	advanced_file_regression.check(actual)