diff options
author | Wouter Bolsterlee <uws@xs4all.nl> | 2012-05-20 22:13:57 +0200 |
---|---|---|
committer | Wouter Bolsterlee <uws@xs4all.nl> | 2012-05-20 22:13:57 +0200 |
commit | 6ad079e9e6ec044dea7a672a0372c6ea58b139dc (patch) | |
tree | 448fe9096554c3861e481f101938f67172697825 /tests/test_util.py | |
parent | f806fdf92755f227ca88dba3ae2b28477a26f531 (diff) | |
download | happybase-6ad079e9e6ec044dea7a672a0372c6ea58b139dc.tar.gz |
Add unit tests (requires nose)
Diffstat (limited to 'tests/test_util.py')
-rw-r--r-- | tests/test_util.py | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/test_util.py b/tests/test_util.py new file mode 100644 index 0000000..1f810dd --- /dev/null +++ b/tests/test_util.py @@ -0,0 +1,29 @@ +""" +HappyBase utility tests. +""" + +from nose.tools import assert_equal + +import happybase.util + + +def test_camel_case_to_pep8(): + def check(lower_cc, upper_cc, correct): + + x1 = happybase.util.camel_case_to_pep8(lower_cc) + x2 = happybase.util.camel_case_to_pep8(upper_cc) + assert_equal(correct, x1) + assert_equal(correct, x2) + + y1 = happybase.util.pep8_to_camel_case(x1, True) + y2 = happybase.util.pep8_to_camel_case(x2, False) + assert_equal(upper_cc, y1) + assert_equal(lower_cc, y2) + + examples = [('foo', 'Foo', 'foo'), + ('fooBar', 'FooBar', 'foo_bar'), + ('fooBarBaz', 'FooBarBaz', 'foo_bar_baz'), + ('fOO', 'FOO', 'f_o_o')] + + for a, b, c in examples: + yield check, a, b, c |