Skip to content

Commit 4bd9eaf

Browse files
committed
Merge pull request #3503 from mboersma/cleanup-regex-test
ref(controller/tests): import regex to be tested, don't copy it
2 parents a37d3d5 + 2af480c commit 4bd9eaf

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import unittest
2-
import re
32

4-
5-
MEMLIMIT = re.compile(r'^(?P<mem>[0-9]+(MB|KB|GB|[BKMG]))$', re.IGNORECASE)
3+
from api.serializers import MEMLIMIT_MATCH
64

75

86
class TestLimits(unittest.TestCase):
9-
10-
def test_upper(self):
11-
self.assertTrue(MEMLIMIT.match("20MB"))
12-
self.assertFalse(MEMLIMIT.match("20MK"))
13-
self.assertTrue(MEMLIMIT.match("20gb"))
14-
self.assertFalse(MEMLIMIT.match("20gK"))
7+
"""Tests the regex for unit format used by "deis limits:set --memory=<limit>".
8+
"""
9+
10+
def test_memlimit_regex(self):
11+
self.assertTrue(MEMLIMIT_MATCH.match("20MB"))
12+
self.assertFalse(MEMLIMIT_MATCH.match("20MK"))
13+
self.assertTrue(MEMLIMIT_MATCH.match("20gb"))
14+
self.assertFalse(MEMLIMIT_MATCH.match("20gK"))

0 commit comments

Comments
 (0)