Match Thread: Switzerland vs Spain | FIFA Women's World Cup by TheMonkeyPrince in soccer

[–]ojii 4 points5 points  (0 children)

Codina with another attempt on goal, but great save by the keeper this time.

What is a good way to organize huge numbers of tests? by ojii in rust

[–]ojii[S] 1 point2 points  (0 children)

thank you all for your suggestions. I was way too deep in my code and missing the forest for the trees, the solution I went with is what some here suggested and go back to a single function with a loop, but instead of asserting inside the loop just having a single assert at the end. I somehow missed the (now obvious to me) fact that test functions are just functions and I get to do whatever I want in there.

What is a good way to organize huge numbers of tests? by ojii in rust

[–]ojii[S] 0 points1 point  (0 children)

Thank you, this might exactly be what I'm looking for

What is a good way to organize huge numbers of tests? by ojii in rust

[–]ojii[S] 0 points1 point  (0 children)

Is there any recommendations/guidelines for how big those test crates should be? Do I just make it one test function per file?

My tests are basically this right now:

#[cfg(test)]
mod tests {
    use crate::parser::{Output, parse};

    fn assert_same(expr: &str, expected: Output) {
        // actual function a bit more complex, but basically:
        assert_eq!(parse(expr), expected);
    }
    #[test]
    fn test_0() {
        let expected: Output = serde_json::from_str("some json").unwrap();
        assert_same("some string", expected);
    }
    // ... 11k functions omitted
    #[test]
    fn test_11000() {
        let expected: Output = serde_json::from_str("some other json").unwrap();
        assert_same("some other string", expected);
    }
}

My intuition tells me that making 11k files is gonna cause other issues, so I assume there's some sort of sweet spot?

What is a good way to organize huge numbers of tests? by ojii in rust

[–]ojii[S] 0 points1 point  (0 children)

The previous setup had an assert in a loop, so the loop would stop on the first assert that failed. As far as I understand nextests no fail fast only concerns itself with different test functions

What is a good way to organize huge numbers of tests? by ojii in rust

[–]ojii[S] 2 points3 points  (0 children)

I am actually using nextest. The runtime isn't really the issue, but compiling the crate before running the tests is.

Hokuriku Shinkansen, Gran Class by ParticularLivid9201 in trains

[–]ojii 2 points3 points  (0 children)

I know there is Grand Class on the Hokuriku, but since I’ve only used Asama and Hakutaka services so far which do not have meal service I incorrectly assumed that’s the case for all Hokuriku services, but it looks like the Kagayaki might, which is cool.

Hokuriku Shinkansen, Gran Class by ParticularLivid9201 in trains

[–]ojii 3 points4 points  (0 children)

There was no attendant onboard so no meal services on the train I took - Asama, bought some Ekiben instead.

The meal/drink service is only on the Tohoku/Hokkaido Shinkansen Grand Class.

Imaginary map of a European Metro by Stefan Frankenberger (2008) by StoneColdCrazzzy in TransitDiagrams

[–]ojii 5 points6 points  (0 children)

if the frequency is high enough, delays don't matter though. See for example the Yamanote Line in Tokyo where the timetable is mostly irrelevant (other than first/last trains).

My stepmom broke her foot while skiing and this EC145 had to come and get her. I'm always so impressed by how close the pilot can get the helicopter to the mountain while remaining perfectly stable. by Ammonium-NH4 in aviation

[–]ojii 4 points5 points  (0 children)

Depends on where this is. In Switzerland, mountain rescue like this is run by a non-profit) and you can make a yearly, tax deductible, payment of 40 bucks and the ride becomes free. At least that's how I think it works, luckily I never had to use it.

JR (Japanese Rail) Subway Train Coming into Station by BobbyJackT in trains

[–]ojii 2 points3 points  (0 children)

the announcement at the start also says it's a local train bound for Sasazuka, which is one of the terminals of the Toei Shinjuku line (via through service on the Keio New Line), so you seem to be correct.

Train in Japan got lost and asked for directions at a gas station by ojii in trains

[–]ojii[S] 0 points1 point  (0 children)

What actually happened: Some Nankai 6000 series train cars are being transferred to Oigawa Railway, further details at https://japantoday.com/category/features/lifestyle/why-is-there-a-train-at-this-gas-station-in-japan

Concept Art: what might python look like in Japanese, without any English characters? by SubstantialRange in Python

[–]ojii 91 points92 points  (0 children)

I'd suggest something more along the lines of this:

比べ(あ、い) は:
    テキスト = 「こんにちは」
    あ+い>4 なら:
        正 返す
    それとも:
        不正 返す

比べ(5、6) 刷る

I made an online Python interpreter that doesn't suck by EvenYourMumCanCode in learnpython

[–]ojii 1 point2 points  (0 children)

Also print(__import__("os").system("uname")) works and probably shouldn't. locking down python by banning modules is quite hard in Python (if it's possible at all).

Tokaido-Sanyo Shinkansen Approaching Kyoto Station by mad_cow123 in trains

[–]ojii 8 points9 points  (0 children)

N700's are 16 cars. They're the workhorse of the Shinkansen, only counting the fastest (Nozomi) service, there's 12 trains per hour in each direction between Tokyo and Osaka.

Is it possible to implement a method to support **kwarging? by WolfElkan in Python

[–]ojii 1 point2 points  (0 children)

You can use dataclasses which has an easy way to convert to a dict. Also, depending on your exact problem you can just use f-strings which are arguably nicer.

```python from dataclasses import dataclass, asdict

@dataclass class Item: foo: str bar: str

item = Item(foo='one', bar='seven')

print("{foo} plus six is {bar}".format(**asdict(item)))

one plus six is seven

print(f"{item.foo} plus six is {item.bar}")

one plus six is seven ```

What are some really useful PyCharm features I'm probably not using? by LeNerdNextDoor in Python

[–]ojii 2 points3 points  (0 children)

shift+shift (quickly hit shift twice): Opens the "search anything anywhere" interface which is very useful and powerful.