Skip to content

Commit b500c04

Browse files
committed
add str2bool test
1 parent a96554b commit b500c04

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/unittests/test_util.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# =================================================================
22
#
33
# Authors: Ricardo Garcia Silva <ricardo.garcia.silva@gmail.com>
4+
# Authors: Tom Kralidis
45
#
56
# Copyright (c) 2017 Ricardo Garcia Silva
7+
# Copyright (c) 2025 Tom Kralidis
68
#
79
# Permission is hereby granted, free of charge, to any person
810
# obtaining a copy of this software and associated documentation
@@ -371,3 +373,16 @@ def test_programmatic_import_with_invalid_path(invalid_import_path):
371373
def test_sanitize_url():
372374
result = util.sanitize_db_connect("postgresql://username:password@localhost/pycsw")
373375
assert result == "postgresql://***:***@localhost/pycsw"
376+
377+
378+
def test_str2bool():
379+
assert util.str2bool('true')
380+
assert util.str2bool(True)
381+
assert util.str2bool('1')
382+
assert util.str2bool('yes')
383+
assert util.str2bool('on')
384+
assert not util.str2bool('0')
385+
assert not util.str2bool('false')
386+
assert not util.str2bool(False)
387+
assert not util.str2bool('off')
388+
assert not util.str2bool('no')

0 commit comments

Comments
 (0)