Реализовал парсер восстановления из бэкапа

This commit is contained in:
Rustam Zaitov 2013-10-29 02:14:45 +04:00
parent ec57e67133
commit d62eacda7d
2 changed files with 30 additions and 0 deletions

View File

@ -0,0 +1,11 @@
import unittest
from parser.BackupParser.RestoreBackupParser import RestoreBackupParser
class TestRestoreBackupParser(unittest.TestCase):
def setUp(self):
self.__parser = RestoreBackupParser()
def test_ValidInput(self):
line = 'restore from backup'
self.__parser.parseLine(line)

View File

@ -0,0 +1,19 @@
from parser.LineParser import LineParser
import re
class RestoreBackupParser(LineParser):
def parseLine(self, line):
assert line is not None
regexpSource = r'restore from backup\s*'
regexp = re.compile(regexpSource, re.UNICODE)
match = regexp.match(line)
self._guardMatch(match, line, regexpSource)
def isValidLine(self, line):
assert line is not None
isValid = line.startswith('restore from backup')