2015-07-04 07:57:24 +08:00
|
|
|
from nose.tools import assert_equal
|
|
|
|
|
|
|
|
|
|
|
|
class TestUniqueChars(object):
|
|
|
|
|
2015-07-12 03:34:14 +08:00
|
|
|
def test_unique_chars(self, func):
|
2016-06-13 11:19:09 +08:00
|
|
|
assert_equal(func(None), False)
|
2015-07-04 07:57:24 +08:00
|
|
|
assert_equal(func(''), True)
|
|
|
|
assert_equal(func('foo'), False)
|
|
|
|
assert_equal(func('bar'), True)
|
|
|
|
print('Success: test_unique_chars')
|
|
|
|
|
2015-07-12 03:34:14 +08:00
|
|
|
|
2015-07-04 07:57:24 +08:00
|
|
|
def main():
|
|
|
|
test = TestUniqueChars()
|
2016-08-13 18:42:05 +08:00
|
|
|
unique_chars = UniqueChars()
|
|
|
|
test.test_unique_chars(unique_chars.has_unique_chars)
|
2015-07-04 07:57:24 +08:00
|
|
|
try:
|
2016-08-13 18:42:05 +08:00
|
|
|
unique_chars_set = UniqueCharsSet()
|
|
|
|
test.test_unique_chars(unique_chars_set.has_unique_chars)
|
|
|
|
unique_chars_in_place = UniqueCharsInPlace()
|
|
|
|
test.test_unique_chars(unique_chars_in_place.has_unique_chars)
|
2015-07-04 07:57:24 +08:00
|
|
|
except NameError:
|
|
|
|
# Alternate solutions are only defined
|
|
|
|
# in the solutions file
|
|
|
|
pass
|
2015-07-12 03:34:14 +08:00
|
|
|
|
|
|
|
|
2015-07-04 07:57:24 +08:00
|
|
|
if __name__ == '__main__':
|
|
|
|
main()
|