Skip to content

Commit a2f2e79

Browse files
test for infer_type
1 parent f98ff99 commit a2f2e79

2 files changed

Lines changed: 12 additions & 2 deletions

File tree

acclimatise/model.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -395,14 +395,14 @@ def infer_type(string) -> typing.Optional[cli_types.CliType]:
395395
elif file_re.match(string):
396396
if input_re.match(string) and not output_re.match(string):
397397
return cli_types.CliFile(output=False)
398-
elif not input_re.match(string) and output_re.match(string):
398+
elif not input_re.match(string) and output_re.match(string):
399399
return cli_types.CliFile(output=True)
400400
else:
401401
return cli_types.CliFile()
402402
elif dir_re.match(string):
403403
if input_re.match(string) and not output_re.match(string):
404404
return cli_types.CliDir(output=False)
405-
elif not input_re.match(string) and output_re.match(string):
405+
elif not input_re.match(string) and output_re.match(string):
406406
return cli_types.CliDir(output=True)
407407
else:
408408
return cli_types.CliDir()

test/test_type_inference.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
from acclimatise.cli_types import CliString
2+
from acclimatise.model import infer_type
3+
4+
5+
def test_type_inference():
6+
test_strings = [("", CliString)]
7+
8+
for ts in test_strings:
9+
typ = infer_type(ts[0])
10+
assert isinstance(typ, ts[1]), "%s should be %s but is %s" % (ts[0], ts[1], typ)

0 commit comments

Comments
 (0)