import pytest
from mappyfile.pprint import PrettyPrinter

def test_print_map():
    mf = {}
    pp = PrettyPrinter() # expected
    txt = pp.pprint(mf)
    assert(expected == txt)

def run_tests():        
    #pytest.main(["tests/test_pprint.py::test_print_map"])
    pytest.main(["tests/test_pprint.py"])

if __name__ == "__main__":
    run_tests()


import pytest
from mappyfile.pprint import PrettyPrinter
import mappyfile

def test_format_list():

    s = """
        CLASS
            STYLE
                COLOR 173 216 230
            END
            STYLE
                OUTLINECOLOR 2 2 2
                WIDTH 1
                LINECAP BUTT
                PATTERN
                    5 5
                    10 10
                END
            END
        END
    """

    ast = mappyfile.loads(s)
    #print ast

    pp = PrettyPrinter(indent=0) # expected

    k = "pattern"
    lst = [[5, 5, 10, 10]]

    assert(pp.is_paired_list(k))
    r = pp.process_list(k, lst, 0)
    exp = [u'PATTERN', '5 5\n10 10', u'END']
    assert(r == exp)

def run_tests():        
    pytest.main(["tests/test_pprint.py::test_format_list"])
    #pytest.main(["tests/test_pprint.py"])

if __name__ == "__main__":
    #run_tests()
    test_format_list()

Add pair list formatting test
Add pair list formatting test

  import pytest
  from mappyfile.pprint import PrettyPrinter
+ import mappyfile
  
- def test_print_map():
-     mf = {}
+ def test_format_list():
+ 
+     s = """
+         CLASS
+             STYLE
+                 COLOR 173 216 230
+             END
+             STYLE
+                 OUTLINECOLOR 2 2 2
+                 WIDTH 1
+                 LINECAP BUTT
+                 PATTERN
+                     5 5
+                     10 10
+                 END
+             END
+         END
+     """
+ 
+     ast = mappyfile.loads(s)
+     #print ast
+ 
-     pp = PrettyPrinter() # expected
+     pp = PrettyPrinter(indent=0) # expected
-     txt = pp.pprint(mf)
-     assert(expected == txt)
+ 
+     k = "pattern"
+     lst = [[5, 5, 10, 10]]
+ 
+     assert(pp.is_paired_list(k))
+     r = pp.process_list(k, lst, 0)
+     exp = [u'PATTERN', '5 5\n10 10', u'END']
+     assert(r == exp)
  
  def run_tests():        
-     #pytest.main(["tests/test_pprint.py::test_print_map"])
+     pytest.main(["tests/test_pprint.py::test_format_list"])
-     pytest.main(["tests/test_pprint.py"])
+     #pytest.main(["tests/test_pprint.py"])
  
  if __name__ == "__main__":
-     run_tests()
+     #run_tests()
+     test_format_list()
  
- 
Add pair list formatting test
## Code Before:
import pytest
from mappyfile.pprint import PrettyPrinter

def test_print_map():
    mf = {}
    pp = PrettyPrinter() # expected
    txt = pp.pprint(mf)
    assert(expected == txt)

def run_tests():        
    #pytest.main(["tests/test_pprint.py::test_print_map"])
    pytest.main(["tests/test_pprint.py"])

if __name__ == "__main__":
    run_tests()


## Instruction:
Add pair list formatting test
## Code After:
import pytest
from mappyfile.pprint import PrettyPrinter
import mappyfile

def test_format_list():

    s = """
        CLASS
            STYLE
                COLOR 173 216 230
            END
            STYLE
                OUTLINECOLOR 2 2 2
                WIDTH 1
                LINECAP BUTT
                PATTERN
                    5 5
                    10 10
                END
            END
        END
    """

    ast = mappyfile.loads(s)
    #print ast

    pp = PrettyPrinter(indent=0) # expected

    k = "pattern"
    lst = [[5, 5, 10, 10]]

    assert(pp.is_paired_list(k))
    r = pp.process_list(k, lst, 0)
    exp = [u'PATTERN', '5 5\n10 10', u'END']
    assert(r == exp)

def run_tests():        
    pytest.main(["tests/test_pprint.py::test_format_list"])
    #pytest.main(["tests/test_pprint.py"])

if __name__ == "__main__":
    #run_tests()
    test_format_list()
