Exemplo n.º 1
0
def test_temp_sys_argv():
    orig_sys_argv = sys.argv
    with path.temp_sys_argv("foo", "bar"):
        print sys.argv
        assert sys.argv == ("foo", "bar")
    assert sys.argv != ["foo", "bar"]
    assert sys.argv == orig_sys_argv
Exemplo n.º 2
0
def test_temp_sys_argv():
    orig_sys_argv = sys.argv
    with path.temp_sys_argv("foo", "bar"):
        print sys.argv
        assert sys.argv == ("foo", "bar")
    assert sys.argv != ["foo", "bar"]
    assert sys.argv == orig_sys_argv
Exemplo n.º 3
0
def test_html2jade():
    html_input = """
<html>
  <head></head>
  <body>
    <div>
      <p>This cost £££</p>
    </div>
  </body>
</html>""".strip()
    jade_expected = (
        """
!!!
html
  head
  body
    div
      p This cost £££""".strip()
        + "\n"
    )
    with path.create_temp_dir() as temp_dir:
        temp_html = temp_dir.child("test.html")
        temp_jade = temp_dir.child("test.jade")
        temp_html.write_text(html_input)
        with path.temp_sys_argv("python", temp_html):
            wiseguy.scripts.html2jade.main()
        assert temp_jade.text() == jade_expected
Exemplo n.º 4
0
def test_parse_jade():
    jade_input = "html: body: div#main"
    html_expected = """
<!DOCTYPE html>
<html>
  <body>
    <div id="main"></div>
  </body>
</html>""".strip()
    with path.create_temp_dir() as temp_dir:
        temp_html = temp_dir.child("test.html")
        temp_jade = temp_dir.child("test.jade")
        temp_jade.write_text(jade_input)
        with path.temp_sys_argv("python", temp_jade):
            wiseguy.scripts.parse_jade.main()
        assert temp_html.text() == html_expected
Exemplo n.º 5
0
def test_parse_jade():
    jade_input = "html: body: div#main"
    html_expected = '''
<!DOCTYPE html>
<html>
  <body>
    <div id="main"></div>
  </body>
</html>'''.strip()
    with path.create_temp_dir() as temp_dir:
        temp_html = temp_dir.child("test.html")
        temp_jade = temp_dir.child("test.jade")
        temp_jade.write_text(jade_input)
        with path.temp_sys_argv("python", temp_jade):
            wiseguy.scripts.parse_jade.main()
        assert temp_html.text() == html_expected
Exemplo n.º 6
0
def test_html2jade():
    html_input = '''
<html>
  <head></head>
  <body>
    <div>
      <p>This cost £££</p>
    </div>
  </body>
</html>'''.strip()
    jade_expected = '''
!!!
html
  head
  body
    div
      p This cost £££'''.strip() + "\n"
    with path.create_temp_dir() as temp_dir:
        temp_html = temp_dir.child("test.html")
        temp_jade = temp_dir.child("test.jade")
        temp_html.write_text(html_input)
        with path.temp_sys_argv("python", temp_html):
            wiseguy.scripts.html2jade.main()
        assert temp_jade.text() == jade_expected