Move names test to pytest
This commit is contained in:
parent
4ed64b0956
commit
8be5c66e14
2 changed files with 14 additions and 20 deletions
|
@ -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
14
util/test/test_names.py
Normal 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
|
Reference in a new issue