-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Gives `is_normal_sequence` a slightly better name and makes it available to packages importing somacore.
- Loading branch information
1 parent
4a0d62a
commit a74f44c
Showing
3 changed files
with
36 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from typing import Any, Iterable | ||
import unittest | ||
|
||
from somacore import types | ||
|
||
|
||
class TestTypes(unittest.TestCase): | ||
def test_is_nonstringy_sequence(self): | ||
seqs: Iterable[Any] = ([], (), range(10)) | ||
for seq in seqs: | ||
with self.subTest(seq): | ||
self.assertTrue(types.is_nonstringy_sequence(seq)) | ||
|
||
non_seqs: Iterable[Any] = (1, "hello", b"goodbye", (x for x in range(10))) | ||
for non_seq in non_seqs: | ||
with self.subTest(non_seq): | ||
self.assertFalse(types.is_nonstringy_sequence(non_seq)) | ||
|
||
def test_slice(self): | ||
self.assertIsInstance(slice(None), types.Slice) | ||
self.assertNotIsInstance((1, 2), types.Slice) |