old_contents: from rply import LexerGenerator
  
  
  class TestLexer(object):
      def test_simple(self):
          lg = LexerGenerator()
          lg.add("NUMBER", r"\d+")
          lg.add("PLUS", r"\+")
  
          l = lg.build()
  
          stream = l.lex("2+3")
          t = stream.next()
          assert t.name == "NUMBER"
          assert t.value == "2"
          t = stream.next()
          assert t.name == "PLUS"
          assert t.value == "+"
          t = stream.next()
          assert t.name == "NUMBER"
          assert t.value == "3"
          assert t.source_pos.idx == 2
          t = stream.next()
          assert t is None
  
      def test_ignore(self):
          lg = LexerGenerator()
          lg.add("NUMBER", r"\d+")
          lg.add("PLUS", r"\+")
          lg.ignore("SPACING", r"\s+")
  
          l = lg.build()
  
          stream = l.lex("2 + 3")
          t = stream.next()
          assert t.name == "NUMBER"
          assert t.value == "2"
          t = stream.next()
          assert t.name == "PLUS"
          assert t.value == "+"
          t = stream.next()
          assert t.name == "NUMBER"
          assert t.value == "3"
          assert t.source_pos.idx == 2
          t = stream.next()
          assert t is None
  
new_contents: from rply import LexerGenerator
  
  
  class TestLexer(object):
      def test_simple(self):
          lg = LexerGenerator()
          lg.add("NUMBER", r"\d+")
          lg.add("PLUS", r"\+")
  
          l = lg.build()
  
          stream = l.lex("2+3")
          t = stream.next()
          assert t.name == "NUMBER"
          assert t.value == "2"
          t = stream.next()
          assert t.name == "PLUS"
          assert t.value == "+"
          t = stream.next()
          assert t.name == "NUMBER"
          assert t.value == "3"
          assert t.source_pos.idx == 2
          t = stream.next()
          assert t is None
  
      def test_ignore(self):
          lg = LexerGenerator()
          lg.add("NUMBER", r"\d+")
          lg.add("PLUS", r"\+")
          lg.ignore("SPACING", r"\s+")
  
          l = lg.build()
  
          stream = l.lex("2 + 3")
          t = stream.next()
          assert t.name == "NUMBER"
          assert t.value == "2"
          t = stream.next()
          assert t.name == "PLUS"
          assert t.value == "+"
          t = stream.next()
          assert t.name == "NUMBER"
          assert t.value == "3"
          assert t.source_pos.idx == 4
          t = stream.next()
          assert t is None
  
subject: fix test