Peano
Loading...
Searching...
No Matches
test_shortened_class_name.py
Go to the documentation of this file.
1from peano4.api.output.Helper import shortened_class_name
2
3
5 assert shortened_class_name("TimeStep_Update_Cell") == "TimeStep_Update_Cell"
6
7
9 first = "A" * 300
10 second = "B" * 300
11 shortened_first = shortened_class_name(first)
12 shortened_second = shortened_class_name(second)
13 assert len(shortened_first) <= 200
14 assert len(shortened_second) <= 200
15 assert shortened_first != shortened_second
16 # The same long name always yields the same short one
17 assert shortened_class_name(first) == shortened_first
18 # The short names end in a consecutive number
19 assert int(shortened_second.rsplit("_", 1)[1]) == int(shortened_first.rsplit("_", 1)[1]) + 1
20
21
24
25 short = peano4.api.solversteps.Step(name="TimeStep_Update_Cell", add_user_defined_actions=False)
26 long = peano4.api.solversteps.Step(name="TimeStep_" + "Update_Cell__" * 10, add_user_defined_actions=False)
27 assert short.get_observer_class_name() == "TimeStep_Update_Cell"
28 assert len(long.get_observer_class_name()) <= 64
29 assert long.get_observer_class_name() == long.get_observer_class_name()
The Python-side model of "what happens during one mesh sweep".
Definition __init__.py:1