Skip to content

Commit dde01c7

Browse files
authored
Merge pull request #1415 from JohnVillalovos/jlvillal/list_attribute_int
feat: add support for lists of integers to ListAttribute
2 parents 5b81d7d + 115938b commit dde01c7

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

gitlab/tests/test_types.py

+5
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,11 @@ def test_list_attribute_get_for_api_from_list():
5959
assert o.get_for_api() == "foo,bar,baz"
6060

6161

62+
def test_list_attribute_get_for_api_from_int_list():
63+
o = types.ListAttribute([1, 9, 7])
64+
assert o.get_for_api() == "1,9,7"
65+
66+
6267
def test_list_attribute_does_not_split_string():
6368
o = types.ListAttribute("foo")
6469
assert o.get_for_api() == "foo"

gitlab/types.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ def get_for_api(self):
4242
if isinstance(self._value, str):
4343
return self._value
4444

45-
return ",".join(self._value)
45+
return ",".join([str(x) for x in self._value])
4646

4747

4848
class LowercaseStringAttribute(GitlabAttribute):

0 commit comments

Comments
 (0)