debian-koji/tests/test_lib/test_parse_arches.py
2020-10-06 15:00:23 +02:00

28 lines
931 B
Python

# coding: utf-8
from __future__ import absolute_import
import unittest
import koji
class TestParseArchesString(unittest.TestCase):
def test_parse_valid_arches(self):
r = koji.parse_arches('i386', to_list=True)
self.assertEqual(['i386'], r)
r = koji.parse_arches('i386 x86_64', to_list=True)
self.assertEqual(['i386', 'x86_64'], r)
r = koji.parse_arches('i386 x86_64 ', to_list=True)
self.assertEqual(['i386', 'x86_64'], r)
r = koji.parse_arches('i386,x86_64', to_list=True)
self.assertEqual(['i386', 'x86_64'], r)
def test_parse_invalid_arches(self):
with self.assertRaises(koji.GenericError):
koji.parse_arches(u'ěšč')
with self.assertRaises(koji.GenericError):
koji.parse_arches(u'i386;x86_64')
with self.assertRaises(koji.GenericError):
koji.parse_arches(u'i386,x86_64', strict=True)