[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [stem/master] Revised enumeration documentation
commit 0e99a269b94f657575690734f4ffff15a17944e0
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date: Fri Nov 9 09:46:54 2012 -0800
Revised enumeration documentation
Our enumerations were only defined in our 'Module Overview' section which sucks
for a few reasons...
1. We can't interlink with the enum definitions.
2. Blocks lack any formatting that could improve readablity.
3. In the long term I'd like to replace the 'Module Overview' blocks with
something better.
Sphinx's python domain directives include a 'data' type, used for global
values. That's exactly what our enums are so using the directive, with tables
to list our enum values.
---
stem/connection.py | 19 +++++--
stem/descriptor/extrainfo_descriptor.py | 69 +++++++++++++++----------
stem/exit_policy.py | 17 ++++--
stem/response/protocolinfo.py | 2 +-
stem/socket.py | 1 -
stem/util/log.py | 34 ++++++++-----
stem/util/proc.py | 21 +++++--
stem/util/term.py | 45 +++++++++++-----
stem/version.py | 20 +++++--
test/integ/descriptor/extrainfo_descriptor.py | 24 ++++----
test/unit/descriptor/extrainfo_descriptor.py | 42 ++++++++--------
11 files changed, 182 insertions(+), 112 deletions(-)
diff --git a/stem/connection.py b/stem/connection.py
index e4971fa..db11e61 100644
--- a/stem/connection.py
+++ b/stem/connection.py
@@ -83,13 +83,20 @@ fine-grained control over the authentication process. For instance...
+- MissingAuthInfo - Unexpected PROTOCOLINFO response, missing auth info
|- NoAuthMethods - Missing any methods for authenticating
+- NoAuthCookie - Supports cookie auth but doesn't have its path
+
+.. data:: AuthMethod (enum)
+
+ Enumeration of PROTOCOLINFO responses for supported authentication methods.
- AuthMethod - Enumeration on PROTOCOLINFO responses for supported authentication methods
- |- NONE - No authentication required
- |- PASSWORD - Password required, see tor's HashedControlPassword option
- |- COOKIE - Contents of the cookie file required, see tor's CookieAuthentication option
- |- SAFECOOKIE - Need to reply to a hmac challenge using the contents of the cookie file
- +- UNKNOWN - Tor provided one or more authentication methods that we don't recognize, probably something new
+ ============== ===========
+ AuthMethod Description
+ ============== ===========
+ **NONE** No authentication required.
+ **PASSWORD** Password required, see tor's HashedControlPassword option.
+ **COOKIE** Contents of the cookie file required, see tor's CookieAuthentication option.
+ **SAFECOOKIE** Need to reply to a hmac challenge using the contents of the cookie file.
+ **UNKNOWN** Tor provided one or more authentication methods that we don't recognize, probably something new.
+ ============== ===========
"""
from __future__ import with_statement
diff --git a/stem/descriptor/extrainfo_descriptor.py b/stem/descriptor/extrainfo_descriptor.py
index 1bb8dac..ec259a8 100644
--- a/stem/descriptor/extrainfo_descriptor.py
+++ b/stem/descriptor/extrainfo_descriptor.py
@@ -23,24 +23,6 @@ Extra-info descriptors are available from a few sources...
::
- DirResponses - known statuses for ExtraInfoDescriptor's dir_*_responses
- |- OK - network status requests that were answered
- |- NOT_ENOUGH_SIGS - network status wasn't signed by enough authorities
- |- UNAVAILABLE - requested network status was unavailable
- |- NOT_FOUND - requested network status was not found
- |- NOT_MODIFIED - network status unmodified since If-Modified-Since time
- +- BUSY - directory was busy
-
- DirStats - known stats for ExtraInfoDescriptor's dir_*_direct_dl and dir_*_tunneled_dl
- |- COMPLETE - requests that completed successfully
- |- TIMEOUT - requests that didn't complete within a ten minute timeout
- |- RUNNING - requests still in process when measurement's taken
- |- MIN - smallest rate at which a descriptor was downloaded in B/s
- |- MAX - largest rate at which a descriptor was downloaded in B/s
- |- D1-4 and D6-9 - rate of the slowest x/10 download rates in B/s
- |- Q1 and Q3 - rate of the slowest and fastest quarter download rates in B/s
- +- MD - median download rate in B/s
-
parse_file - Iterates over the extra-info descriptors in a file.
ExtraInfoDescriptor - Tor extra-info descriptor.
| |- RelayExtraInfoDescriptor - Extra-info descriptor for a relay.
@@ -48,6 +30,39 @@ Extra-info descriptors are available from a few sources...
|
|- digest - calculates the digest value for our content
+- get_unrecognized_lines - lines with unrecognized content
+
+.. data:: DirResponse (enum)
+
+ Enumeration for known statuses for ExtraInfoDescriptor's dir_*_responses.
+
+ =================== ===========
+ DirResponse Description
+ =================== ===========
+ **OK** network status requests that were answered
+ **NOT_ENOUGH_SIGS** network status wasn't signed by enough authorities
+ **UNAVAILABLE** requested network status was unavailable
+ **NOT_FOUND** requested network status was not found
+ **NOT_MODIFIED** network status unmodified since If-Modified-Since time
+ **BUSY** directory was busy
+ =================== ===========
+
+.. data:: DirStat (enum)
+
+ Enumeration for known stats for ExtraInfoDescriptor's dir_*_direct_dl and
+ dir_*_tunneled_dl.
+
+ ===================== ===========
+ DirStat Description
+ ===================== ===========
+ **COMPLETE** requests that completed successfully
+ **TIMEOUT** requests that didn't complete within a ten minute timeout
+ **RUNNING** requests still in process when measurement's taken
+ **MIN** smallest rate at which a descriptor was downloaded in B/s
+ **MAX** largest rate at which a descriptor was downloaded in B/s
+ **D1-4** and **D6-9** rate of the slowest x/10 download rates in B/s
+ **Q1** and **Q3** rate of the slowest and fastest quarter download rates in B/s
+ **MD** median download rate in B/s
+ ===================== ===========
"""
import re
@@ -59,7 +74,7 @@ import stem.util.enum
import stem.util.connection
# known statuses for dirreq-v2-resp and dirreq-v3-resp...
-DirResponses = stem.util.enum.Enum(
+DirResponse = stem.util.enum.Enum(
("OK", "ok"),
("NOT_ENOUGH_SIGS", "not-enough-sigs"),
("UNAVAILABLE", "unavailable"),
@@ -72,7 +87,7 @@ DirResponses = stem.util.enum.Enum(
dir_stats = ['complete', 'timeout', 'running', 'min', 'max', 'q1', 'q3', 'md']
dir_stats += ['d%i' % i for i in range(1, 5)]
dir_stats += ['d%i' % i for i in range(6, 10)]
-DirStats = stem.util.enum.Enum(*[(stat.upper(), stat) for stat in dir_stats])
+DirStat = stem.util.enum.Enum(*[(stat.upper(), stat) for stat in dir_stats])
# relay descriptors must have exactly one of the following
REQUIRED_FIELDS = (
@@ -226,18 +241,18 @@ class ExtraInfoDescriptor(stem.descriptor.Descriptor):
:var dict dir_v2_requests: mapping of locales to rounded count of requests
:var dict dir_v3_requests: mapping of locales to rounded count of requests
- :var dict dir_v2_responses: mapping of **DirResponses** to their rounded count
- :var dict dir_v3_responses: mapping of **DirResponses** to their rounded count
+ :var dict dir_v2_responses: mapping of :data:`~stem.descriptor.extrainfo_descriptor.DirResponse` to their rounded count
+ :var dict dir_v3_responses: mapping of :data:`~stem.descriptor.extrainfo_descriptor.DirResponse` to their rounded count
:var dict dir_v2_responses_unknown: mapping of unrecognized statuses to their count
:var dict dir_v3_responses_unknown: mapping of unrecognized statuses to their count
- :var dict dir_v2_direct_dl: mapping of **DirStats** to measurement over DirPort
- :var dict dir_v3_direct_dl: mapping of **DirStats** to measurement over DirPort
+ :var dict dir_v2_direct_dl: mapping of :data:`~stem.descriptor.extrainfo_descriptor.DirStat` to measurement over DirPort
+ :var dict dir_v3_direct_dl: mapping of :data:`~stem.descriptor.extrainfo_descriptor.DirStat` to measurement over DirPort
:var dict dir_v2_direct_dl_unknown: mapping of unrecognized stats to their measurement
:var dict dir_v3_direct_dl_unknown: mapping of unrecognized stats to their measurement
- :var dict dir_v2_tunneled_dl: mapping of **DirStats** to measurement over ORPort
- :var dict dir_v3_tunneled_dl: mapping of **DirStats** to measurement over ORPort
+ :var dict dir_v2_tunneled_dl: mapping of :data:`~stem.descriptor.extrainfo_descriptor.DirStat` to measurement over ORPort
+ :var dict dir_v3_tunneled_dl: mapping of :data:`~stem.descriptor.extrainfo_descriptor.DirStat` to measurement over ORPort
:var dict dir_v2_tunneled_dl_unknown: mapping of unrecognized stats to their measurement
:var dict dir_v3_tunneled_dl_unknown: mapping of unrecognized stats to their measurement
@@ -494,7 +509,7 @@ class ExtraInfoDescriptor(stem.descriptor.Descriptor):
unrecognized_counts = {}
is_response_stats = keyword in ("dirreq-v2-resp", "dirreq-v3-resp")
- key_set = DirResponses if is_response_stats else DirStats
+ key_set = DirResponse if is_response_stats else DirStat
key_type = "STATUS" if is_response_stats else "STAT"
error_msg = "%s lines should contain %s=COUNT mappings: %s" % (keyword, key_type, line)
diff --git a/stem/exit_policy.py b/stem/exit_policy.py
index f228786..159fa2c 100644
--- a/stem/exit_policy.py
+++ b/stem/exit_policy.py
@@ -35,11 +35,18 @@ exiting to a destination is permissible or not. For instance...
|- is_port_wildcard - checks if we'll accept any port
|- is_match - checks if we match a given destination
+- __str__ - string representation for this rule
+
+.. data:: AddressType (enum)
+
+ Enumerations for IP address types that can be in an exit policy.
- AddressType - Enumerations for IP address types that can be in an exit policy
- |- WILDCARD - any address of either IPv4 or IPv6
- |- IPv4 - IPv4 address
- +- IPv6 - IPv6 address
+ ============ ===========
+ AddressType Description
+ ============ ===========
+ **WILDCARD** any address of either IPv4 or IPv6
+ **IPv4** IPv4 address
+ **IPv6** IPv6 address
+ ============ ===========
"""
import stem.util.connection
@@ -342,7 +349,7 @@ class ExitPolicyRule(object):
:var str rule: rule that we were originally created from
:var bool is_accept: indicates if exiting is allowed or disallowed
- :var AddressType address_type: type of address that we have
+ :var stem.exit_policy.AddressType address_type: type of address that we have
:var str address: address that this rule is for
:var str mask: subnet mask for the address (ex. "255.255.255.0")
:var int masked_bits: number of bits the subnet mask represents, **None** if
diff --git a/stem/response/protocolinfo.py b/stem/response/protocolinfo.py
index d696a4d..2db542d 100644
--- a/stem/response/protocolinfo.py
+++ b/stem/response/protocolinfo.py
@@ -14,7 +14,7 @@ class ProtocolInfoResponse(stem.response.ControlMessage):
:var int protocol_version: protocol version of the response
:var stem.version.Version tor_version: version of the tor process
- :var tuple auth_methods: AuthMethod types that tor will accept
+ :var tuple auth_methods: :data:`stem.connection.AuthMethod` types that tor will accept
:var tuple unknown_auth_methods: strings of unrecognized auth methods
:var str cookie_path: path of tor's authentication cookie
"""
diff --git a/stem/socket.py b/stem/socket.py
index 6528f97..ebaaaae 100644
--- a/stem/socket.py
+++ b/stem/socket.py
@@ -35,7 +35,6 @@ import socket
import threading
import stem.response
-import stem.util.enum
import stem.util.log as log
class ControlSocket(object):
diff --git a/stem/util/log.py b/stem/util/log.py
index 62b2bbc..d7a64ea 100644
--- a/stem/util/log.py
+++ b/stem/util/log.py
@@ -1,13 +1,6 @@
"""
-Functions to aid library logging. Default logging is usually NOTICE and above,
-runlevels being used as follows...
-
-* **ERROR** - critical issue occurred, the user needs to be notified
-* **WARN** - non-critical issue occurred that the user should be aware of
-* **NOTICE** - information that is helpful to the user
-* **INFO** - high level library activity
-* **DEBUG** - low level library activity
-* **TRACE** - request/reply logging
+Functions to aid library logging. The default logging
+:data:`~stem.util.log.Runlevel` is usually NOTICE and above.
**Module Overview:**
@@ -31,6 +24,21 @@ runlevels being used as follows...
+- __iter__ - iterates over and removes the buffered events
log_to_stdout - reports further logged events to stdout
+
+.. data:: Runlevel (enum)
+
+ Enumeration for logging runlevels.
+
+ ========== ===========
+ Runlevel Description
+ ========== ===========
+ **ERROR** critical issue occurred, the user needs to be notified
+ **WARN** non-critical issue occurred that the user should be aware of
+ **NOTICE** information that is helpful to the user
+ **INFO** high level library activity
+ **DEBUG** low level library activity
+ **TRACE** request/reply logging
+ ========== ===========
"""
import logging
@@ -88,7 +96,7 @@ def logging_level(runlevel):
"""
Translates a runlevel into the value expected by the logging module.
- :param Runlevel runlevel: runlevel to be returned, no logging if **None**
+ :param stem.util.log.Runlevel runlevel: runlevel to be returned, no logging if **None**
"""
if runlevel: return LOG_VALUES[runlevel]
@@ -112,7 +120,7 @@ def log(runlevel, message):
"""
Logs a message at the given runlevel.
- :param Runlevel runlevel: runlevel to log the message at, logging is skipped if **None**
+ :param stem.util.log.Runlevel runlevel: runlevel to log the message at, logging is skipped if **None**
:param str message: message to be logged
"""
@@ -125,7 +133,7 @@ def log_once(message_id, runlevel, message):
been logged then this is a no-op.
:param str message_id: unique message identifier to deduplicate on
- :param Runlevel runlevel: runlevel to log the message at, logging is skipped if **None**
+ :param stem.util.log.Runlevel runlevel: runlevel to log the message at, logging is skipped if **None**
:param str message: message to be logged
:returns: **True** if we log the message, **False** otherwise
@@ -179,7 +187,7 @@ def log_to_stdout(runlevel):
"""
Logs further events to stdout.
- :param Runlevel runlevel: minimum runlevel a message needs to be to be logged
+ :param stem.util.log.Runlevel runlevel: minimum runlevel a message needs to be to be logged
"""
logging.basicConfig(
diff --git a/stem/util/proc.py b/stem/util/proc.py
index 084caf2..36e7e8a 100644
--- a/stem/util/proc.py
+++ b/stem/util/proc.py
@@ -21,6 +21,19 @@ Dave Daeschler, Giampaolo Rodola' and is under the BSD license.
get_memory_usage - provides the memory usage of a process
get_stats - queries statistics about a process
get_connections - provides the connections made by a process
+
+.. data:: Stat (enum)
+
+ Types of data available via the :func:`~stem.util.proc.get_stats` function.
+
+ ============== ===========
+ Stat Description
+ ============== ===========
+ **COMMAND** command name under which the process is running
+ **CPU_UTIME** total user time spent on the process
+ **CPU_STIME** total system time spent on the process
+ **START_TIME** when this process began, in unix time
+ ============== ===========
"""
import os
@@ -199,12 +212,8 @@ def get_memory_usage(pid):
def get_stats(pid, *stat_types):
"""
- Provides process specific information. Options are:
-
- * **Stat.COMMAND** - command name under which the process is running
- * **Stat.CPU_UTIME** - total user time spent on the process
- * **Stat.CPU_STIME** - total system time spent on the process
- * **Stat.START_TIME** - when this process began, in unix time
+ Provides process specific information. See the :data:`~stem.util.proc.Stat`
+ enum for valid options.
:param int pid: process id of the process to be queried
:param Stat stat_types: information to be provided back
diff --git a/stem/util/term.py b/stem/util/term.py
index 1c97989..d0bb02b 100644
--- a/stem/util/term.py
+++ b/stem/util/term.py
@@ -5,22 +5,37 @@ Utilities for working with the terminal.
::
- Color - enumeration for terminal colors
- |- BLACK
- |- BLUE
- |- CYAN
- |- GREEN
- |- MAGENTA
- |- RED
- |- WHITE
- +- YELLOW
+ format - wrap text with ANSI for the given colors or attributes
+
+.. data:: Color (enum)
+.. data:: BgColor (enum)
- Attr - enumeration of terminal text attributes
- |- BOLD
- |- HILIGHT
- +- UNDERLINE
+ Enumerations for foreground or background terminal color.
- format - wrap text with ANSI for the given colors or attributes
+ =========== ===========
+ Color Description
+ =========== ===========
+ **BLACK** black color
+ **BLUE** blue color
+ **CYAN** cyan color
+ **GREEN** green color
+ **MAGENTA** magenta color
+ **RED** red color
+ **WHITE** white color
+ **YELLOW** yellow color
+ =========== ===========
+
+.. data:: Attr (enum)
+
+ Enumerations of terminal text attributes.
+
+ ============= ===========
+ Attr Description
+ ============= ===========
+ **BOLD** heavy typeface
+ **HILIGHT** inverted foreground and background
+ **UNDERLINE** underlined text
+ ============= ===========
"""
import stem.util.enum
@@ -51,7 +66,7 @@ def format(msg, *attr):
* `colorama <http://pypi.python.org/pypi/colorama>`_
:param str msg: string to be formatted
- :param str attr: text attributes, this can be Color, BgColor, or Attr enums
+ :param str attr: text attributes, this can be :data:`~stem.util.term.Color`, :data:`~stem.util.term.BgColor`, or :data:`~stem.util.term.Attr` enums
and are case insensitive (so strings like "red" are fine)
:returns: **str** wrapped with ANSI escape encodings, starting with the given
diff --git a/stem/version.py b/stem/version.py
index 8a792b3..522c9f2 100644
--- a/stem/version.py
+++ b/stem/version.py
@@ -26,12 +26,22 @@ easily parsed and compared, for instance...
|- greater_than - adds rule that matches if we're greater than a version
|- less_than - adds rule that matches if we're less than a version
+- in_range - adds rule that matches if we're within a given version range
+
+.. data:: Requirement (enum)
+
+ Enumerations for the version requirements of features.
- Requirement - Enumerations for the version requirements of features
- |- AUTH_SAFECOOKIE - 'SAFECOOKIE' authentication method
- |- GETINFO_CONFIG_TEXT - 'GETINFO config-text' query
- |- TORRC_CONTROL_SOCKET - 'ControlSocket <path>' config option
- +- TORRC_DISABLE_DEBUGGER_ATTACHMENT - 'DisableDebuggerAttachment' config option
+ ===================================== ===========
+ Requirement Description
+ ===================================== ===========
+ **AUTH_SAFECOOKIE** 'SAFECOOKIE' authentication method
+ **GETINFO_CONFIG_TEXT** 'GETINFO config-text' query
+ **LOADCONF** 'LOADCONF' query
+ **TORRC_CONTROL_SOCKET** 'ControlSocket <path>' config option
+ **TORRC_DISABLE_DEBUGGER_ATTACHMENT** 'DisableDebuggerAttachment' config option
+ **FEATURE_VERBOSE_NAMES** 'VERBOSE_NAMES' optional feature
+ **FEATURE_EXTENDED_EVENTS** 'EXTENDED_EVENTS' optional feature
+ ===================================== ===========
"""
import re
diff --git a/test/integ/descriptor/extrainfo_descriptor.py b/test/integ/descriptor/extrainfo_descriptor.py
index fd9a4cf..9206ae6 100644
--- a/test/integ/descriptor/extrainfo_descriptor.py
+++ b/test/integ/descriptor/extrainfo_descriptor.py
@@ -11,7 +11,7 @@ import unittest
import stem.descriptor.extrainfo_descriptor
import test.runner
import test.integ.descriptor
-from stem.descriptor.extrainfo_descriptor import DirResponses
+from stem.descriptor.extrainfo_descriptor import DirResponse
class TestExtraInfoDescriptor(unittest.TestCase):
def test_metrics_relay_descriptor(self):
@@ -78,20 +78,20 @@ k0d2aofcVbHr4fPQOSST0LXDrhFl5Fqo5um296zpJGvRUeO6S44U/EfJAGShtqWw
descriptor_file.close()
expected_dir_v2_responses = {
- DirResponses.OK: 0,
- DirResponses.UNAVAILABLE: 0,
- DirResponses.NOT_FOUND: 0,
- DirResponses.NOT_MODIFIED: 0,
- DirResponses.BUSY: 0,
+ DirResponse.OK: 0,
+ DirResponse.UNAVAILABLE: 0,
+ DirResponse.NOT_FOUND: 0,
+ DirResponse.NOT_MODIFIED: 0,
+ DirResponse.BUSY: 0,
}
expected_dir_v3_responses = {
- DirResponses.OK: 72,
- DirResponses.NOT_ENOUGH_SIGS: 0,
- DirResponses.UNAVAILABLE: 0,
- DirResponses.NOT_FOUND: 0,
- DirResponses.NOT_MODIFIED: 0,
- DirResponses.BUSY: 0,
+ DirResponse.OK: 72,
+ DirResponse.NOT_ENOUGH_SIGS: 0,
+ DirResponse.UNAVAILABLE: 0,
+ DirResponse.NOT_FOUND: 0,
+ DirResponse.NOT_MODIFIED: 0,
+ DirResponse.BUSY: 0,
}
desc = stem.descriptor.extrainfo_descriptor.BridgeExtraInfoDescriptor(descriptor_contents)
diff --git a/test/unit/descriptor/extrainfo_descriptor.py b/test/unit/descriptor/extrainfo_descriptor.py
index 7ae38a7..011a0e5 100644
--- a/test/unit/descriptor/extrainfo_descriptor.py
+++ b/test/unit/descriptor/extrainfo_descriptor.py
@@ -4,7 +4,7 @@ Unit tests for stem.descriptor.extrainfo_descriptor.
import datetime
import unittest
-from stem.descriptor.extrainfo_descriptor import RelayExtraInfoDescriptor, DirResponses, DirStats
+from stem.descriptor.extrainfo_descriptor import RelayExtraInfoDescriptor, DirResponse, DirStat
from test.mocking import get_relay_extrainfo_descriptor, get_bridge_extrainfo_descriptor, CRYPTO_BLOB
class TestExtraInfoDescriptor(unittest.TestCase):
@@ -122,10 +122,10 @@ class TestExtraInfoDescriptor(unittest.TestCase):
test_value = "ok=0,unavailable=0,not-found=984,not-modified=0,something-new=7"
desc = get_relay_extrainfo_descriptor({keyword: test_value})
- self.assertEquals(0, getattr(desc, attr)[DirResponses.OK])
- self.assertEquals(0, getattr(desc, attr)[DirResponses.UNAVAILABLE])
- self.assertEquals(984, getattr(desc, attr)[DirResponses.NOT_FOUND])
- self.assertEquals(0, getattr(desc, attr)[DirResponses.NOT_MODIFIED])
+ self.assertEquals(0, getattr(desc, attr)[DirResponse.OK])
+ self.assertEquals(0, getattr(desc, attr)[DirResponse.UNAVAILABLE])
+ self.assertEquals(984, getattr(desc, attr)[DirResponse.NOT_FOUND])
+ self.assertEquals(0, getattr(desc, attr)[DirResponse.NOT_MODIFIED])
self.assertEquals(7, getattr(desc, unknown_attr)["something-new"])
test_entries = (
@@ -152,22 +152,22 @@ class TestExtraInfoDescriptor(unittest.TestCase):
test_value = "complete=2712,timeout=32,running=4,min=741,d1=14507,d2=22702,q1=28881,d3=38277,d4=73729,md=111455,d6=168231,d7=257218,q3=319833,d8=390507,d9=616301,something-new=11,max=29917857"
desc = get_relay_extrainfo_descriptor({keyword: test_value})
- self.assertEquals(2712, getattr(desc, attr)[DirStats.COMPLETE])
- self.assertEquals(32, getattr(desc, attr)[DirStats.TIMEOUT])
- self.assertEquals(4, getattr(desc, attr)[DirStats.RUNNING])
- self.assertEquals(741, getattr(desc, attr)[DirStats.MIN])
- self.assertEquals(14507, getattr(desc, attr)[DirStats.D1])
- self.assertEquals(22702, getattr(desc, attr)[DirStats.D2])
- self.assertEquals(28881, getattr(desc, attr)[DirStats.Q1])
- self.assertEquals(38277, getattr(desc, attr)[DirStats.D3])
- self.assertEquals(73729, getattr(desc, attr)[DirStats.D4])
- self.assertEquals(111455, getattr(desc, attr)[DirStats.MD])
- self.assertEquals(168231, getattr(desc, attr)[DirStats.D6])
- self.assertEquals(257218, getattr(desc, attr)[DirStats.D7])
- self.assertEquals(319833, getattr(desc, attr)[DirStats.Q3])
- self.assertEquals(390507, getattr(desc, attr)[DirStats.D8])
- self.assertEquals(616301, getattr(desc, attr)[DirStats.D9])
- self.assertEquals(29917857, getattr(desc, attr)[DirStats.MAX])
+ self.assertEquals(2712, getattr(desc, attr)[DirStat.COMPLETE])
+ self.assertEquals(32, getattr(desc, attr)[DirStat.TIMEOUT])
+ self.assertEquals(4, getattr(desc, attr)[DirStat.RUNNING])
+ self.assertEquals(741, getattr(desc, attr)[DirStat.MIN])
+ self.assertEquals(14507, getattr(desc, attr)[DirStat.D1])
+ self.assertEquals(22702, getattr(desc, attr)[DirStat.D2])
+ self.assertEquals(28881, getattr(desc, attr)[DirStat.Q1])
+ self.assertEquals(38277, getattr(desc, attr)[DirStat.D3])
+ self.assertEquals(73729, getattr(desc, attr)[DirStat.D4])
+ self.assertEquals(111455, getattr(desc, attr)[DirStat.MD])
+ self.assertEquals(168231, getattr(desc, attr)[DirStat.D6])
+ self.assertEquals(257218, getattr(desc, attr)[DirStat.D7])
+ self.assertEquals(319833, getattr(desc, attr)[DirStat.Q3])
+ self.assertEquals(390507, getattr(desc, attr)[DirStat.D8])
+ self.assertEquals(616301, getattr(desc, attr)[DirStat.D9])
+ self.assertEquals(29917857, getattr(desc, attr)[DirStat.MAX])
self.assertEquals(11, getattr(desc, unknown_attr)["something-new"])
test_entries = (
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits