-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #29 from eriknovak/tests
Change unit tests to use pytest
- Loading branch information
Showing
13 changed files
with
806 additions
and
853 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
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 |
---|---|---|
@@ -1,48 +1,40 @@ | ||
import unittest | ||
|
||
from anonipy.definitions import Entity | ||
|
||
|
||
# ===================================== | ||
# Test Entity | ||
# ===================================== | ||
|
||
|
||
class TestEntity(unittest.TestCase): | ||
|
||
def test_init_default(self): | ||
entity = Entity( | ||
text="test", | ||
label="test", | ||
start_index=0, | ||
end_index=4, | ||
) | ||
self.assertEqual(entity.text, "test") | ||
self.assertEqual(entity.label, "test") | ||
self.assertEqual(entity.start_index, 0) | ||
self.assertEqual(entity.end_index, 4) | ||
self.assertEqual(entity.score, 1.0) | ||
self.assertEqual(entity.type, None) | ||
self.assertEqual(entity.regex, ".*") | ||
|
||
def test_init_custom(self): | ||
entity = Entity( | ||
text="test", | ||
label="test", | ||
start_index=0, | ||
end_index=4, | ||
score=0.89, | ||
type="test", | ||
regex="test", | ||
) | ||
self.assertEqual(entity.text, "test") | ||
self.assertEqual(entity.label, "test") | ||
self.assertEqual(entity.start_index, 0) | ||
self.assertEqual(entity.end_index, 4) | ||
self.assertEqual(entity.score, 0.89) | ||
self.assertEqual(entity.type, "test") | ||
self.assertEqual(entity.regex, "test") | ||
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() | ||
def test_init_default(): | ||
entity = Entity( | ||
text="test", | ||
label="test", | ||
start_index=0, | ||
end_index=4, | ||
) | ||
assert entity.text == "test" | ||
assert entity.label == "test" | ||
assert entity.start_index == 0 | ||
assert entity.end_index == 4 | ||
assert entity.score == 1.0 | ||
assert entity.type is None | ||
assert entity.regex == ".*" | ||
|
||
|
||
def test_init_custom(): | ||
entity = Entity( | ||
text="test", | ||
label="test", | ||
start_index=0, | ||
end_index=4, | ||
score=0.89, | ||
type="test", | ||
regex="test", | ||
) | ||
assert entity.text == "test" | ||
assert entity.label == "test" | ||
assert entity.start_index == 0 | ||
assert entity.end_index == 4 | ||
assert entity.score == 0.89 | ||
assert entity.type == "test" | ||
assert entity.regex == "test" |
Oops, something went wrong.