1+ from pathlib import Path
2+
13import pytest
24from twill import utils
35from twill .errors import TwillException
46
57
8+ def test_is_hidden_filename ():
9+ is_hidden_filename = utils .is_hidden_filename
10+ assert not is_hidden_filename ("foo" )
11+ assert is_hidden_filename (".foo" )
12+ assert not is_hidden_filename (".foo/bar" )
13+ assert is_hidden_filename ("foo/.bar" )
14+
15+
16+ def test_is_twill_filename ():
17+ is_twill_filename = utils .is_twill_filename
18+ assert not is_twill_filename ("foo" )
19+ assert is_twill_filename ("foo.twill" )
20+ assert not is_twill_filename (".foo.twill" )
21+
22+
623def test_make_boolean ():
724 make_boolean = utils .make_boolean
825 assert make_boolean (True ) # noqa: FBT003
@@ -19,6 +36,18 @@ def test_make_boolean():
1936 make_boolean ("no" )
2037
2138
39+ def test_make_twill_filename ():
40+ make_twill_filename = utils .make_twill_filename
41+ assert make_twill_filename ("test_foo" ) == "test_foo"
42+ assert make_twill_filename ("../tests/test_foo" ) == str (
43+ Path ("../tests/test_foo" )
44+ )
45+ assert make_twill_filename ("test_basic" ) == "test_basic.twill"
46+ assert make_twill_filename ("../tests/test_basic" ) == str (
47+ Path ("../tests/test_basic.twill" )
48+ )
49+
50+
2251def test_trunc ():
2352 trunc = utils .trunc
2453 assert trunc ("hello, world!" , 12 ) == "hello, w ..."
0 commit comments