mirror of https://github.com/exaloop/codon.git
Add copy helper function to list (#4)
* Add copy helper function to list * Add list.copy test Co-authored-by: ‘markhend’ <‘markhend@gmail.com’>pull/5/head
parent
dcf1e9ba33
commit
fa51d0b583
|
@ -328,6 +328,9 @@ class List:
|
|||
self[j] = x
|
||||
i += 1
|
||||
|
||||
def copy(self):
|
||||
return self.__copy__()
|
||||
|
||||
# Internal helpers
|
||||
|
||||
def _idx_check(self, idx: int, msg: str):
|
||||
|
|
|
@ -115,6 +115,9 @@ def test_list():
|
|||
l6.extend(['xyz'])
|
||||
l6.extend('')
|
||||
assert l6 == ['a', 'b', 'c', 'xyz']
|
||||
|
||||
assert List[int]().copy() == List[int]()
|
||||
assert [1,2,3].copy() == [1,2,3]
|
||||
test_list()
|
||||
|
||||
@test
|
||||
|
|
Loading…
Reference in New Issue