pep8: use triple double-quotes for docstrings

This commit is contained in:
Thomas Waldmann 2014-11-18 17:39:04 +01:00
parent 0812e371aa
commit d51f762ddd
6 changed files with 12 additions and 12 deletions

View File

@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
"""
Check translation lacked or disused.
Example:
@ -24,7 +24,7 @@ es disused gui_starting_server
2. load translation key from locale/*.json.
3. compare these.
'''
"""
import fileinput, argparse, re, os, codecs, json, sys

View File

@ -29,7 +29,7 @@ class NoTor(Exception): pass
class TailsError(Exception): pass
def hsdic2list(dic):
"Convert what we get from get_conf_map to what we need for set_options"
"""Convert what we get from get_conf_map to what we need for set_options"""
return [
pair for pairs in [
[('HiddenServiceDir',vals[0]),('HiddenServicePort',vals[1])]

View File

@ -22,12 +22,12 @@ from nose import with_setup
import test_helpers
def test_get_platform_on_tails():
"get_platform() returns 'Tails' when hostname is 'amnesia'"
"""get_platform() returns 'Tails' when hostname is 'amnesia'"""
helpers.platform.uname = lambda: ('Linux', 'amnesia', '3.14-1-amd64', '#1 SMP Debian 3.14.4-1 (2014-05-13)', 'x86_64', '')
assert helpers.get_platform() == 'Tails'
def test_get_platform_returns_platform_system():
"get_platform() returns platform.system() when ONIONSHARE_PLATFORM is not defined"
"""get_platform() returns platform.system() when ONIONSHARE_PLATFORM is not defined"""
helpers.platform.system = lambda: 'Sega Saturn'
assert helpers.get_platform() == 'Sega Saturn'

View File

@ -22,17 +22,17 @@ from onionshare import strings
from nose import with_setup
def test_starts_with_empty_strings():
"creates an empty strings dict by default"
"""creates an empty strings dict by default"""
assert strings.strings == {}
def test_load_strings_defaults_to_english():
"load_strings() loads English by default"
"""load_strings() loads English by default"""
locale.getdefaultlocale = lambda: ('en_US', 'UTF-8')
strings.load_strings()
assert strings._('wait_for_hs') == "Waiting for HS to be ready:"
def test_load_strings_loads_other_languages():
"load_strings() loads other languages in different locales"
"""load_strings() loads other languages in different locales"""
locale.getdefaultlocale = lambda: ('fr_FR', 'UTF-8')
strings.load_strings("fr")
assert strings._('wait_for_hs') == "En attente du HS:"

View File

@ -21,13 +21,13 @@ from onionshare import OnionShare
from nose import with_setup
def test_choose_port_returns_a_port_number():
"choose_port() returns a port number"
"""choose_port() returns a port number"""
app = OnionShare()
app.choose_port()
assert 1024 <= app.port <= 65535
def test_choose_port_returns_an_open_port():
"choose_port() returns an open port"
"""choose_port() returns an open port"""
app = OnionShare()
# choose a new port
app.choose_port()

View File

@ -20,11 +20,11 @@ from onionshare import web
from nose import with_setup
def test_generate_slug_length():
"generates a 26-character slug"
"""generates a 26-character slug"""
assert len(web.slug) == 26
def test_generate_slug_characters():
"generates a base32-encoded slug"
"""generates a base32-encoded slug"""
def is_b32(string):
b32_alphabet = "01234556789abcdefghijklmnopqrstuvwxyz"