Skip to content

Instantly share code, notes, and snippets.

@ibizaman
Created April 7, 2014 15:17
Show Gist options
  • Save ibizaman/10022270 to your computer and use it in GitHub Desktop.
Save ibizaman/10022270 to your computer and use it in GitHub Desktop.
======================================== test session starts =========================================
platform linux -- Python 3.3.0 -- py-1.4.20 -- pytest-2.5.2
collected 792 items
tests/test_base.py .
tests/test_dumper.py .............................................................................................................................
tests/test_formatting_grouper.py ...............................................................................................................................................................................
tests/test_grammator.py ..................................
tests/test_grammator_control_structures.py ....................
tests/test_grammator_data_structures.py ...................................
tests/test_grammator_imports.py ........................
tests/test_grammator_operators.py .....................................................................................................................................
tests/test_grammator_primitives.py .............................
tests/test_grouper.py ........................................
tests/test_indentation_marker.py ..........
tests/test_inner_formatting_grouper.py ...........
tests/test_spliter.py ...................................................................................F
tests/test_tokenizer.py .......................................................................
============================================== FAILURES ==============================================
__________________________________________ test_remove_crap __________________________________________
def test_remove_crap():
> assert split("\x0c\xef\xbb\xbf") == []
tests/test_spliter.py:272:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sequence = '\x0c'
def split(sequence):
> return list(split_generator(sequence))
baron/spliter.py:6:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
sequence = '\x0c'
def split_generator(sequence):
iterator = FlexibleIterator(sequence)
while True:
if iterator.end():
return
not_found = True
if iterator.next_in("#"):
not_found = False
result = iterator.grab(lambda iterator: (iterator.show_next() not in "\r\n"))
yield result
for section in ("'", '"'):
if iterator.next_starts_with(section * 3):
not_found = False
result = next(iterator)
result += next(iterator)
result += next(iterator)
result += iterator.grab_string(lambda iterator: not iterator.next_starts_with(section * 3))
result += next(iterator)
result += next(iterator)
result += next(iterator)
yield result
elif iterator.next_in(section):
not_found = False
result = next(iterator)
result += iterator.grab_string(lambda iterator: iterator.show_next() not in section)
result += next(iterator)
yield result
for section in (string.ascii_letters + "_" + "1234567890", " \t"):
if iterator.next_in(section):
not_found = False
yield iterator.grab(lambda iterator: iterator.show_next() in section)
for one in "@,.;()=*:+-/^%&<>|\r\n~[]{}!``\\":
if iterator.next_in(one):
not_found = False
yield next(iterator)
if iterator.show_next().__repr__().startswith("'\\x"):
# guys, seriously, how do you manage to put this shit in your code?
# I mean, I don't even know how this is possible!
# example of guitly file: ve/lib/python2.7/site-packages/tests/test_oauth.py
# example of crapy unicode stuff found in some source files: \x0c\xef\xbb\xbf
not_found = False
# let's drop that crap
next(iterator)
if not_found:
> raise Exception("Untreaded elements: %s" % iterator.rest_of_the_sequence().__repr__()[:50])
E Exception: Untreaded elements: ''
baron/spliter.py:60: Exception
================================ 1 failed, 791 passed in 8.36 seconds ================================
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment