(t *testing.T)
| 10 | ) |
| 11 | |
| 12 | func TestNamespaceValidity(t *testing.T) { |
| 13 | testCases := []struct { |
| 14 | namespace string |
| 15 | ok bool |
| 16 | }{ |
| 17 | // data from Python's namespace_manager_test.py |
| 18 | {"", true}, |
| 19 | {"__a.namespace.123__", true}, |
| 20 | {"-_A....NAMESPACE-_", true}, |
| 21 | {"-", true}, |
| 22 | {".", true}, |
| 23 | {".-", true}, |
| 24 | |
| 25 | {"?", false}, |
| 26 | {"+", false}, |
| 27 | {"!", false}, |
| 28 | {" ", false}, |
| 29 | } |
| 30 | for _, tc := range testCases { |
| 31 | _, err := Namespace(context.Background(), tc.namespace) |
| 32 | if err == nil && !tc.ok { |
| 33 | t.Errorf("Namespace %q should be rejected, but wasn't", tc.namespace) |
| 34 | } else if err != nil && tc.ok { |
| 35 | t.Errorf("Namespace %q should be accepted, but wasn't", tc.namespace) |
| 36 | } |
| 37 | } |
| 38 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…