MCPcopy Create free account
hub / github.com/SplootCode/splootcode / testSets

Method testSets

python/tests/test_execute.py:315–334  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

313 self.assertEqual(f.read(), "() ('hi',) ('a', 'b')\n")
314
315 def testSets(self):
316 splootFile = splootFromPython('''x = {1, 2, 1, 1}
317y = set()
318z = {"a", 'b'}
319print(x, y, z)
320''')
321
322 f = io.StringIO()
323 f.write = wrapStdout(f.write)
324 with contextlib.redirect_stdout(f):
325 executePythonFile(splootFile)
326
327 f.seek(0)
328 # Order is not guaranteed for a set
329 self.assertIn(f.read(), [
330 "{1, 2} set() {'a', 'b'}\n",
331 "{1, 2} set() {'b', 'a'}\n",
332 "{2, 1} set() {'a', 'b'}\n",
333 "{2, 1} set() {'b', 'a'}\n",
334 ])
335
336 def testDictionaryAssignment(self):
337 splootFile = splootFromPython('''x = {}

Callers

nothing calls this directly

Calls 4

splootFromPythonFunction · 0.90
wrapStdoutFunction · 0.90
executePythonFileFunction · 0.90
readMethod · 0.80

Tested by

no test coverage detected