X-Git-Url: http://mj.ucw.cz/gitweb/?a=blobdiff_plain;f=t%2Fmoe%2Fstatus.py;h=144bf486f66afffaf6e272d79a74ebc7b727e43a;hb=3b2c0c783bf7284037f4c5c5ffd6582ee7b1f89c;hp=3a5c34f6218a0d6da06e85330e6e9b76fc18b257;hpb=258204ca478a8e8c180931575e1cd0748f677e8c;p=moe.git diff --git a/t/moe/status.py b/t/moe/status.py index 3a5c34f..144bf48 100644 --- a/t/moe/status.py +++ b/t/moe/status.py @@ -2,14 +2,20 @@ import sys import types import re -key_pattern = re.compile("\A[A-Za-z0-9_-]+\Z") +key_pattern_str = "\A[A-Za-z0-9_-]+\Z" +key_pattern = re.compile(key_pattern_str) -class InvalidStatusFile(Exception): +class InvalidStatusFile(StandardError): pass -class Status: +class Status(object): """ - (One subtree of) Moe status file. + (One subtree of) a status file. + + Each Status is a dictionary with string keys matching the specs. and + values either strings or nested Status subtrees. + + The class defines `__getitem__`, `__setitem__`, `__eq__` and `keys`. """ def __init__(self): @@ -151,3 +157,5 @@ class Status: this = stk.pop() else: raise InvalidStatusFile("Parse error: malformed line") + if stk: + raise InvalidStatusFile("Parse error: not all subtrees closed")