File: test_string.py

package info (click to toggle)
monty 2025.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 820 kB
  • sloc: python: 5,261; makefile: 136; sh: 20
file content (12 lines) | stat: -rw-r--r-- 315 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
from __future__ import annotations

import random

from monty.string import remove_non_ascii


def test_remove_non_ascii():
    s = "".join(chr(random.randint(0, 127)) for _ in range(10))
    s += "".join(chr(random.randint(128, 150)) for _ in range(10))
    clean = remove_non_ascii(s)
    assert len(clean) == 10