importpytestfrom..importutilsLINES_SLUG=[(["hello world"],"hello_world"),(["?%#/&\\"],"~q~p~h~s~a~b"),(["a/b","c"],"a~sb/c"),(["variable_name"],"variable__name"),(["variable-name"],"variable--name"),(["foo\nbar"],"foo~nbar"),(["def data() -> Dict"],"def_data()_-->_Dict"),(['That\'s not how "this" works'],"That's_not_how_''this''_works"),]@pytest.mark.parametrize(("lines","slug"),LINES_SLUG)deftest_encode(expect,lines,slug):expect(utils.text.encode(lines))==slug@pytest.mark.parametrize(("lines","slug"),LINES_SLUG)deftest_decode(expect,lines,slug):expect(utils.text.decode(slug))==linesdeftest_decode_dashes(expect):expect(utils.text.decode("hello-world"))==["hello world"]