Skip to content

Instantly share code, notes, and snippets.

View masiarek's full-sized avatar

Adam Masiarek masiarek

View GitHub Profile
@masiarek
masiarek / main.rs
Last active November 26, 2024 12:39
compilation fails - however, cargo test is OK
fn factorial(n: u64) -> u64 {
if n == 0 || n == 1 {
1
} else {
n * factorial(n - 1)
}
}
#[cfg(test)]
mod tests {
@masiarek
masiarek / main.rs
Last active November 26, 2024 12:40
compilation is OK - however "cargo test" fails
fn main() {
fn factorial(n: u64) -> u64 {
if n == 0 || n == 1 {
1
} else {
n * factorial(n - 1)
}
}
}
#[cfg(test)]
@masiarek
masiarek / main.rs
Last active November 26, 2024 12:41
both work OK (compilation and cargo test)
fn main() {}
fn factorial(n: u64) -> u64 {
if n == 0 || n == 1 {
1
} else {
n * factorial(n - 1)
}
}
struct Feelings {
flag1: bool,
flag2: bool,
}
impl Feelings {
fn feel_good(&self) -> bool {
self.flag1
}
}
### Keybase proof
I hereby claim:
* I am masiarek on github.
* I am a_masiarek (https://keybase.io/a_masiarek) on keybase.
* I have a public key ASAptImDJxWgKF_h6FAwW5jg7pnu6lmMbV36IsXEW3X4BAo
To claim this, I am signing this object:
import pytest
@pytest.fixture(autouse=True, scope="module")
def fix_module():
print("\nFix module setup")
yield
print("\nFix module teardown")
import csv
from collections import defaultdict
dd = defaultdict(list)
with open("BKPF.txt") as bkpf:
dd = csv.DictReader(bkpf)
print(*dd.fieldnames, sep="|")
for e in dd:
print(*e.values())
from collections import defaultdict
from pprint import pp
left = [{1: ["10", "11"]}, {2: ["20", "21"]}]
right = [
{"10": ["a", "b"]},
{"11": ["a", "b"]},
{"20": ["x", "y"]},
{"21": ["x", "z"]}, # <== here is a difference!
]
import pandas as pd
import io, csv
A = """
k1,k2,a3
1,44,x
2,55,y
3,66,z"""
B = """
import pandas as pd
from io import StringIO
import io
A = """
k1,k2,a3
1,44,x
2,55,y
3,66,z"""