python_arango_ogm.utils.test_str_util

 1import logging
 2from python_arango_ogm.utils.str_util import squish_text, snake_text, title_text
 3
 4
 5TEST_INPUT = """
 6  Foo {
 7
 8
 9    Bar {
10      Baz[]
11    }
12
13  }
14"""
15
16def test_squish():
17  squished = squish_text(TEST_INPUT)
18  logging.info(squished)
19  assert squished == 'Foo{ Bar{ Baz[] } }'
20
21def test_snake():
22  # assert snake_text('foo!@#!&*^&&!@bar') == 'foo_bar'
23  assert snake_text('BarFood') == 'bar_food'
24
25def test_title():
26  assert title_text('FooBar') == 'Foo Bar'
27  assert title_text('fooBar') == 'Foo Bar'
28  assert title_text('foo_bar') == 'Foo Bar'
29  assert title_text('ABC') == 'ABC'
TEST_INPUT = '\n Foo {\n\n\n Bar {\n Baz[]\n }\n\n }\n'
def test_squish():
17def test_squish():
18  squished = squish_text(TEST_INPUT)
19  logging.info(squished)
20  assert squished == 'Foo{ Bar{ Baz[] } }'
def test_snake():
22def test_snake():
23  # assert snake_text('foo!@#!&*^&&!@bar') == 'foo_bar'
24  assert snake_text('BarFood') == 'bar_food'
def test_title():
26def test_title():
27  assert title_text('FooBar') == 'Foo Bar'
28  assert title_text('fooBar') == 'Foo Bar'
29  assert title_text('foo_bar') == 'Foo Bar'
30  assert title_text('ABC') == 'ABC'