diff options
author | Lars Wirzenius <liw@liw.fi> | 2016-09-25 18:48:03 +0300 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2016-09-25 18:48:03 +0300 |
commit | 2a5ceeafa683780e679b07c5e9199c196ee65703 (patch) | |
tree | ce158c08e82bb3930b42219b9f43b5d37e80ba1a | |
parent | ce3456fc26e02cc369b287a6ef7245c03be0a7f1 (diff) | |
download | server-yarns-2a5ceeafa683780e679b07c5e9199c196ee65703.tar.gz |
Start a YarnHelper class
-rwxr-xr-x | check | 5 | ||||
-rw-r--r-- | yarnhelper.py | 30 | ||||
-rw-r--r-- | yarnhelper_tests.py | 30 |
3 files changed, 65 insertions, 0 deletions
@@ -0,0 +1,5 @@ +#!/bin/sh + +set -eu + +python -m CoverageTestRunner diff --git a/yarnhelper.py b/yarnhelper.py new file mode 100644 index 0000000..f313ab4 --- /dev/null +++ b/yarnhelper.py @@ -0,0 +1,30 @@ +# Copyright 2016 Lars Wirzenius +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# =*= License: GPL-3+ =*= + + +class YarnHelper(object): + + def set_environment(self, env): + pass + + def get_next_match(self): + raise Error('no next match') + + +class Error(Exception): + + pass diff --git a/yarnhelper_tests.py b/yarnhelper_tests.py new file mode 100644 index 0000000..2e64f93 --- /dev/null +++ b/yarnhelper_tests.py @@ -0,0 +1,30 @@ +# Copyright 2016 Lars Wirzenius +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. +# +# =*= License: GPL-3+ =*= + + +import unittest + +import yarnhelper + + +class GetNextMatchTests(unittest.TestCase): + + def test_raises_error_if_no_next_match(self): + h = yarnhelper.YarnHelper() + h.set_environment({}) + with self.assertRaises(yarnhelper.Error): + h.get_next_match() |