-
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
Showing
1 changed file
with
63 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import pprint | ||
import unittest | ||
from typing import Dict | ||
|
||
from fingerprint_pro_server_api_sdk import BaseModel | ||
|
||
|
||
class ExampleModel(BaseModel): | ||
"""Example model that inherits from BaseModel for testing purposes.""" | ||
swagger_types: Dict[str, str] = { | ||
'name': 'str', | ||
'details': 'dict' | ||
} | ||
|
||
attribute_map: Dict[str, str] = { | ||
'name': 'name', | ||
'details': 'details' | ||
} | ||
|
||
def __init__(self, name=None, details=None): | ||
self.name = name | ||
self.details = details | ||
|
||
|
||
class MyTestCase(unittest.TestCase): | ||
|
||
def setUp(self): | ||
"""Set up test fixtures.""" | ||
self.model = ExampleModel(name="Test Model", details={"key": "value"}) | ||
|
||
def test_to_dict(self): | ||
"""Test conversion to dictionary.""" | ||
expected = { | ||
'name': "Test Model", | ||
'details': {"key": "value"} | ||
} | ||
self.assertEqual(self.model.to_dict(), expected) | ||
|
||
def test_to_str(self): | ||
"""Test conversion to string.""" | ||
expected_str = pprint.pformat(self.model.to_dict()) | ||
self.assertEqual(self.model.to_str(), expected_str) | ||
|
||
def test_repr(self): | ||
"""Test __repr__ method.""" | ||
expected_repr = self.model.to_str() | ||
self.assertEqual(repr(self.model), expected_repr) | ||
|
||
def test_eq(self): | ||
"""Test equality comparison.""" | ||
model1 = ExampleModel(name="Test Model", details={"key": "value"}) | ||
model2 = ExampleModel(name="Test Model", details={"key": "value"}) | ||
self.assertTrue(model1 == model2) | ||
|
||
def test_ne(self): | ||
"""Test inequality comparison.""" | ||
model1 = ExampleModel(name="Test Model", details={"key": "value"}) | ||
model2 = ExampleModel(name="Test Model", details={"key": "different_value"}) | ||
self.assertTrue(model1 != model2) | ||
|
||
|
||
if __name__ == '__main__': | ||
unittest.main() |