Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
TOML order is random on py3.5 or older
Signed-off-by: Chris Warrick <kwpolska@gmail.com>
  • Loading branch information
Kwpolska committed Jul 14, 2017
1 parent 47629b5 commit 74bb288
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions tests/test_utils.py
Expand Up @@ -377,7 +377,7 @@ def test_write_metadata_with_formats():
data = {'slug': 'hello-world', 'title': 'Hello, world!', 'b': '2', 'a': '1'}
# Nikola: defaults first, then sorted alphabetically
# YAML: all sorted alphabetically
# TOML: insertion order
# TOML: insertion order (py3.6), random (py3.5 or older)
assert write_metadata(data, 'nikola') == """\
.. title: Hello, world!
.. slug: hello-world
Expand All @@ -393,14 +393,13 @@ def test_write_metadata_with_formats():
title: Hello, world!
---
"""
assert write_metadata(data, 'toml') == """\
+++
slug = "hello-world"
title = "Hello, world!"
b = "2"
a = "1"
+++
"""
toml = write_metadata(data, 'toml')
assert toml.startswith('+++\n')
assert toml.endswith('+++\n')
assert 'slug = "hello-world"' in toml
assert 'title = "Hello, world!"' in toml
assert 'b = "2"' in toml
assert 'a = "1"' in toml


def test_write_metadata_comment_wrap():
Expand Down Expand Up @@ -464,5 +463,6 @@ def test_write_metadata_from_site_and_fallbacks():
assert write_metadata(data, 'foo') == '.. title: xx\n\n'
assert write_metadata(data, 'filename_regex') == '.. title: xx\n\n'


if __name__ == '__main__':
unittest.main()

0 comments on commit 74bb288

Please sign in to comment.