From 0b797d14a609172d4965320aa30eae9e9c1f892e Mon Sep 17 00:00:00 2001 From: Kevin Deldycke Date: Wed, 2 Mar 2016 11:35:28 +0100 Subject: [PATCH] Add is_uuid unit-tests, including garbage types. --- tests/test_strutils.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tests/test_strutils.py b/tests/test_strutils.py index bdc9993..dd4981f 100644 --- a/tests/test_strutils.py +++ b/tests/test_strutils.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +import uuid + from boltons import strutils @@ -14,3 +16,11 @@ def test_indent(): to_indent = '\nabc\ndef\n\nxyz\n' ref = '\n abc\n def\n\n xyz\n' assert strutils.indent(to_indent, ' ') == ref + + +def test_is_uuid(): + assert strutils.is_uuid(uuid.uuid4()) == True + assert strutils.is_uuid(uuid.uuid4(), version=1) == False + assert strutils.is_uuid(str(uuid.uuid4())) == True + assert strutils.is_uuid(str(uuid.uuid4()), version=1) == False + assert strutils.is_uuid(set('garbage')) == False