Fix so-yaml get to output booleans in YAML format and add bool test

This commit is contained in:
Mike Reeves
2026-03-13 15:58:47 -04:00
parent 1713f6af76
commit 12dec366e0
2 changed files with 14 additions and 1 deletions
+11
View File
@@ -406,6 +406,17 @@ class TestRemove(unittest.TestCase):
self.assertEqual(result, 0)
self.assertEqual("hello\n", mock_stdout.getvalue())
def test_get_bool(self):
with patch('sys.stdout', new=StringIO()) as mock_stdout:
filename = "/tmp/so-yaml_test-get.yaml"
file = open(filename, "w")
file.write("{key1: { child1: 123, child2: { deep1: 45 } }, key2: false, key3: [e,f,g]}")
file.close()
result = soyaml.get([filename, "key2"])
self.assertEqual(result, 0)
self.assertEqual("false\n", mock_stdout.getvalue())
def test_get_list(self):
with patch('sys.stdout', new=StringIO()) as mock_stdout:
filename = "/tmp/so-yaml_test-get.yaml"