Move names test to pytest

This commit is contained in:
Joseph Schorr 2018-07-18 11:10:44 -04:00
parent 4ed64b0956
commit 8be5c66e14
2 changed files with 14 additions and 20 deletions

View file

@ -1,20 +0,0 @@
import unittest
from util.names import escape_tag
class TestEscapeTag(unittest.TestCase):
def assertTag(self, input_tag, expected):
self.assertEquals(expected, escape_tag(input_tag))
def test_basic_tag(self):
self.assertTag('latest', 'latest')
self.assertTag('latest124', 'latest124')
self.assertTag('5de1e98d', '5de1e98d')
def test_invalid_tag(self):
self.assertTag('detailed_view#61', 'detailed_view_61')
self.assertTag('-detailed_view#61', '_detailed_view_61')
if __name__ == '__main__':
unittest.main()

14
util/test/test_names.py Normal file
View file

@ -0,0 +1,14 @@
import pytest
from util.names import escape_tag
@pytest.mark.parametrize('input_tag, expected', [
('latest', 'latest'),
('latest124', 'latest124'),
('5de1e98d', '5de1e98d'),
('detailed_view#61', 'detailed_view_61'),
('-detailed_view#61', '_detailed_view_61')
])
def test_escape_tag(input_tag, expected):
assert escape_tag(input_tag) == expected