From 29aa81a694c8e70423ccf13b81dab78c00134b91 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Mon, 1 Jun 2015 15:46:14 +0100 Subject: [PATCH] Adding a couple of unit tests for some of the more interesting types. --- wlauto/tests/test_utils.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/wlauto/tests/test_utils.py b/wlauto/tests/test_utils.py index 3cc6b7e2..74e159d8 100644 --- a/wlauto/tests/test_utils.py +++ b/wlauto/tests/test_utils.py @@ -17,11 +17,11 @@ # pylint: disable=R0201 from unittest import TestCase -from nose.tools import raises, assert_equal # pylint: disable=E0611 +from nose.tools import raises, assert_equal, assert_not_equal # pylint: disable=E0611 from wlauto.utils.android import check_output from wlauto.utils.misc import merge_dicts, TimeoutError -from wlauto.utils.types import list_or_integer, list_or_bool +from wlauto.utils.types import list_or_integer, list_or_bool, caseless_string, arguments class TestCheckOutput(TestCase): @@ -70,3 +70,16 @@ class TestTypes(TestCase): assert_equal(list_or_integer('0xF'), [15,]) assert_equal(list_or_bool('False'), [False,]) + def test_caseless_string(self): + cs1 = caseless_string('TeSt') + assert_equal(cs1, 'TeSt') + assert_equal('test', cs1) + assert_equal(cs1[0], 'T') + assert_not_equal(cs1[0], 't') + assert_not_equal(cs1, 'test2') + + def test_arguments(self): + assert_equal(arguments('--foo 7 --bar "fizz buzz"'), + ['--foo', '7', '--bar', 'fizz buzz']) + assert_equal(arguments(['test', 42]), ['test', '42']) +