-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f2138e0
commit a2bb2eb
Showing
4 changed files
with
59 additions
and
3 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
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,56 @@ | ||
# SPDX-FileCopyrightText: 2024-present Unital Software <[email protected]> | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
import unittest | ||
|
||
from tempe.data_view import Count | ||
|
||
|
||
class TestCount(unittest.TestCase): | ||
|
||
def test_count(self): | ||
"""Test count starts and steps as expected.""" | ||
|
||
count = Count(10, 5) | ||
count_iter = iter(count) | ||
|
||
self.assertEqual(next(count_iter), 10) | ||
self.assertEqual(next(count_iter), 15) | ||
self.assertEqual(next(count_iter), 20) | ||
|
||
def test_count_getitem(self): | ||
"""Test count getitem works as expected.""" | ||
|
||
count = Count(10, 5) | ||
|
||
self.assertEqual(count[0], 10) | ||
self.assertEqual(count[1], 15) | ||
self.assertEqual(count[2], 20) | ||
|
||
def test_count_default(self): | ||
"""Test count default starts and steps as expected.""" | ||
|
||
count = Count() | ||
count_iter = iter(count) | ||
|
||
self.assertEqual(next(count_iter), 0) | ||
self.assertEqual(next(count_iter), 1) | ||
self.assertEqual(next(count_iter), 2) | ||
|
||
def test_count_default_getitem(self): | ||
"""Test count default getitem works as expected.""" | ||
|
||
count = Count() | ||
|
||
self.assertEqual(count[0], 0) | ||
self.assertEqual(count[1], 1) | ||
self.assertEqual(count[2], 2) | ||
|
||
|
||
if __name__ == "__main__": | ||
result = unittest.main() | ||
if not result.wasSuccessful(): | ||
import sys | ||
|
||
sys.exit(1) |