(self)
| 122 | self.assertSurvivesConversion([None, None, None, 2], encoding='utf8') |
| 123 | |
| 124 | def test_sparse_list(self): |
| 125 | func1 = self.lua.eval(""" |
| 126 | function (arr) |
| 127 | arr[5] = "foo" |
| 128 | return arr |
| 129 | end |
| 130 | """) |
| 131 | func2 = self.lua.eval(""" |
| 132 | function (arr) |
| 133 | arr[100000] = "foo" |
| 134 | return arr |
| 135 | end |
| 136 | """) |
| 137 | arr = python2lua(self.lua, [1, 2]) |
| 138 | arr1 = lua2python(self.lua, func1(arr)) |
| 139 | self.assertEqual(arr1, [1, 2, None, None, "foo"]) |
| 140 | |
| 141 | with pytest.raises(ValueError): |
| 142 | arr2 = lua2python(self.lua, func2(arr)) |
| 143 | |
| 144 | def test_list_like_tables(self): |
| 145 | # List-like tables are still returned as dicts; |
nothing calls this directly
no test coverage detected