def test_simple_metadata_with_spaces( text='python string = "value" number = 1.0 array = ["a", "b"]', value=("python", {"string": "value", "number": 1.0, "array": ["a", "b"]}), ): compare(text_to_metadata(text), value) assert ( metadata_to_text(*value) == 'python string="value" number=1.0 array=["a", "b"]' )
def test_title_and_json_dict( text='cell title {"string": "value", "number": 1.0, "array": ["a", "b"]}', value=("cell title", {"string": "value", "number": 1.0, "array": ["a", "b"]}), ): compare(text_to_metadata(text, allow_title=True), value) assert ( metadata_to_text(*value) == 'cell title string="value" number=1.0 array=["a", "b"]' )
def test_title_and_relax_json( text="cell title string='value' number=1.0 array=['a', \"b\"]", value=("cell title", {"string": "value", "number": 1.0, "array": ["a", "b"]}), ): compare(text_to_metadata(text, allow_title=True), value) assert ( metadata_to_text(*value) == 'cell title string="value" number=1.0 array=["a", "b"]' )
def test_simple_metadata( text='python string="value" number=1.0 array=["a", "b"]', value=('python', { 'string': 'value', 'number': 1.0, 'array': ['a', 'b'] })): compare(text_to_metadata(text), value) assert metadata_to_text(*value) == text
def test_title_and_json_dict( text='cell title {"string": "value", "number": 1.0, "array": ["a", "b"]}', value=('cell title', { 'string': 'value', 'number': 1.0, 'array': ['a', 'b'] })): compare(text_to_metadata(text, allow_title=True), value) assert metadata_to_text( *value) == 'cell title string="value" number=1.0 array=["a", "b"]'
def test_title_and_relax_json( text="cell title string='value' number=1.0 array=['a', \"b\"]", value=('cell title', { 'string': 'value', 'number': 1.0, 'array': ['a', 'b'] })): compare(text_to_metadata(text, allow_title=True), value) assert metadata_to_text( *value) == 'cell title string="value" number=1.0 array=["a", "b"]'
def test_language_and_attribute(text="python .class", value=("python", { ".class": None })): compare(text_to_metadata(text), value) assert metadata_to_text(*value) == text
def test_attribute(allow_title): text = ".class" value = ("", {".class": None}) compare(text_to_metadata(text, allow_title), value) assert metadata_to_text(*value) == text
def test_title_no_metadata(text="title", value=("title", {})): compare(text_to_metadata(text, allow_title=True), value) assert metadata_to_text(*value) == text.strip()
def test_language_metadata_no_space(text='python{"a":1}', value=("python", { "a": 1 })): compare(text_to_metadata(text), value) assert metadata_to_text(*value) == "python a=1"
def test_no_language(text=".class", value=("", {".class": None})): compare(text_to_metadata(text), value) assert metadata_to_text(*value) == text
def test_no_language(text='.class', value=('', {'.class': None})): compare(text_to_metadata(text), value) assert metadata_to_text(*value) == text
def test_incorrectly_encoded(text="this is an incorrect expression d={{4 b=3"): value = text_to_metadata(text, allow_title=True) assert metadata_to_text(*value) == text
def test_values_with_equal_signs_inside(text='python string="value=5"', value=('python', { 'string': 'value=5' })): compare(text_to_metadata(text), value) assert metadata_to_text(*value) == text
def test_title_and_attribute(text="This is my title. .class", value=("This is my title.", { ".class": None })): compare(text_to_metadata(text, allow_title=True), value) assert metadata_to_text(*value) == text
def test_language_no_metadata(text="python", value=("python", {})): compare(text_to_metadata(text), value) assert metadata_to_text(*value) == text.strip()
def test_values_with_equal_signs_inside(text='python string="value=5"', value=("python", { "string": "value=5" })): compare(text_to_metadata(text), value) assert metadata_to_text(*value) == text
def test_only_metadata_2(text='key="value"', value=("", {"key": "value"})): compare(text_to_metadata(text, allow_title=True), value) assert metadata_to_text(*value) == text
def test_incorrectly_encoded_json( text='this is an incorrect expression {"d": "}'): value = text_to_metadata(text, allow_title=True) assert metadata_to_text(*value) == text
def test_only_metadata_2(text='key="value"', value=('', {'key': 'value'})): compare(text_to_metadata(text, allow_title=True), value) assert metadata_to_text(*value) == text