question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some Open/Read tests are failing.

See original GitHub issue
with open('compression/du cote de chez swann.txt', 'rb') as f:
    assert len(f.read()) == 1_056_294

with open('compression/du cote de chez swann.txt', 'r') as f:
    assert len(f.readlines()) == 2118

with open('compression/du cote de chez swann.txt', 'r') as f:
    counter = 0
    for line in f:
        counter += 1
    assert counter == 2118

Output

Traceback (most recent call last):
AssertionError: AssertionError

<completed in 313.00 ms (FAILED)>

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (12 by maintainers)

github_iconTop GitHub Comments

2reactions
PierreQuentelcommented, Jul 14, 2021

Oh, I see now. The difference between 1_054_176 and 1_056_294 is the number of lines in the text, 2118. It’s a question of line feed being converted from 2 characters \r\n to 1 character \n. I have modified the test to accept both values.

1reaction
PierreQuentelcommented, Jul 28, 2021

Sorry for the last answer, I am almost full time on Pattern Matching these days.

I have just changed the test to accept 2117 as well, although I can’t reproduce the bug (CPython also gives 2118).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unit testing of class using File.OpenRead() - Stack Overflow
Currently, I am creating a file just to create a FileStream ... Of course, the tests are regularly failing with a IOException because...
Read more >
Problems with .NET unit testing - Rider Support | JetBrains
Go to the directory with dotnet executable via terminal. Run "dotnet --version" command.
Read more >
Unit tests fail in Test Explorer but runs without any problem in ...
Miroslav, I'm asking if the tests that are failing when you "Run All" pass if you try to run them under the debugger....
Read more >
Mocking System.IO filesystem in unit tests in ASP.NET Core
Let's see now how to write some simple unit tests for this controller with Moq package and Xunit. using Moq; using SampleApi.Controllers; using ......
Read more >
dotnet test command - .NET CLI | Microsoft Learn
The dotnet test command is used to execute unit tests in a given project. ... otherwise if any test fails, it returns 1....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found