def integer_is_dumped_as_string(): assert_equal("1", dumps(1))
def long_is_dumped_as_string(): assert_equal("1", dumps(long(1)))
def multiline_dict_value_is_separated_by_newline_from_previous_value(): assert_equal( "two: false\n\none: - 3\n - 2", dumps(OrderedDict([("two", False), ("one", [3, 2])])) )
def items_in_lists_are_separated_by_blank_line_if_they_are_multiline(): assert_equal("- - 3\n - 2\n\n- - 1\n - 0", dumps([[3, 2], [1, 0]]))
def keys_in_dicts_are_right_aligned(): assert_equal( "a-long-key: 1\n short: 2", dumps(OrderedDict([("a-long-key", 1), ("short", 2)])) )
def lists_are_dumped_with_each_element_on_new_line_preceded_by_hyphen(): assert_equal("- 3\n- 2\n- 1", dumps([3, 2, 1]))
def nested_lists_cause_extra_indentation(): assert_equal("- - 3\n - 2", dumps([[3, 2]]))
def booleans_are_dumped_as_lowercase_string(): assert_equal("false", dumps(False)) assert_equal("true", dumps(True))
def long_is_dumped_as_string(): assert_equal("1.2", dumps(1.2))
def dumping_dicts_separates_key_and_value_with_colon_and_items_with_newlines(): assert_equal("one: 1\ntwo: 2", dumps(OrderedDict([("one", 1), ("two", 2)])))
def keys_in_dicts_are_right_aligned(): assert_equal("a-long-key: 1\n short: 2", dumps(OrderedDict([("a-long-key", 1), ("short", 2)])))
def values_within_dicts_are_indented_if_they_are_on_multiple_lines(): assert_equal("one: - 3\n - 2\n - 1", dumps({"one": [3, 2, 1]}))
def dumping_dicts_separates_key_and_value_with_colon_and_items_with_newlines(): assert_equal( "one: 1\ntwo: 2", dumps(OrderedDict([("one", 1), ("two", 2)])) )
def multiline_dict_value_is_separated_by_newline_from_previous_value(): assert_equal("two: false\n\none: - 3\n - 2", dumps(OrderedDict([("two", False), ("one", [3, 2])])))
def values_within_dicts_are_indented_if_they_are_on_multiple_lines(): assert_equal( "one: - 3\n - 2\n - 1", dumps({"one": [3, 2, 1]}) )
def string_is_dumped_as_string_without_quotations(): assert_equal("hello", dumps("hello"))
def write_result(self, value): self._output_file.write(marmoset.dumps(value)) self._output_file.write("\n")