summaryrefslogtreecommitdiff
path: root/tests/unit/test_base.py
diff options
context:
space:
mode:
authorJohn L. Villalovos <john@sodarock.com>2021-11-24 17:43:46 -0800
committerJohn L. Villalovos <john@sodarock.com>2021-11-24 20:41:36 -0800
commit308210b3dee15c844cd5db4ddd8c7404bb188990 (patch)
tree4df88a7a967e209afcf2efea9efc5fd8be358128 /tests/unit/test_base.py
parentab82fd84ba3cecf766915112dcb46fdfab383e73 (diff)
downloadgitlab-jlvillal/mypy_strict.tar.gz
WIP: work on enable mypy 'strict' modejlvillal/mypy_strict
Diffstat (limited to 'tests/unit/test_base.py')
-rw-r--r--tests/unit/test_base.py11
1 files changed, 9 insertions, 2 deletions
diff --git a/tests/unit/test_base.py b/tests/unit/test_base.py
index 137f480..902d9b4 100644
--- a/tests/unit/test_base.py
+++ b/tests/unit/test_base.py
@@ -117,8 +117,8 @@ class TestRESTObject:
obj.id = 42
assert 42 == obj.get_id()
- obj.id = None
- assert obj.get_id() is None
+ obj.id = "hello"
+ assert "hello" == obj.get_id()
def test_custom_id_attr(self, fake_manager):
class OtherFakeObject(FakeObject):
@@ -127,6 +127,13 @@ class TestRESTObject:
obj = OtherFakeObject(fake_manager, {"foo": "bar"})
assert "bar" == obj.get_id()
+ def test_custom_id_attr_missing(self, fake_manager):
+ class OtherFakeObject(FakeObject):
+ _id_attr = "spam"
+
+ obj = OtherFakeObject(fake_manager, {"foo": "bar"})
+ assert obj.get_id() is None
+
def test_update_attrs(self, fake_manager):
obj = FakeObject(fake_manager, {"foo": "bar"})
obj.bar = "baz"