File: test_registry_oceania.py

package info (click to toggle)
python-calendra 7.11.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,600 kB
  • sloc: python: 16,840; makefile: 6
file content (47 lines) | stat: -rw-r--r-- 1,163 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
from unittest import TestCase

from ..oceania import (
    Australia,
    MarshallIslands,
    NewZealand,
    # Australian territories
    AustralianCapitalTerritory,
    NewSouthWales,
    NorthernTerritory,
    Queensland,
    SouthAustralia,
    Tasmania,
    # FIXME: there's no ISO code for this city. Shall we add it?
    # Hobart,
    Victoria,
    WesternAustralia
)

from ..registry import registry

AUSTRALIAN_TERRITORIES = (
    AustralianCapitalTerritory,
    NewSouthWales,
    NorthernTerritory,
    Queensland,
    SouthAustralia,
    Tasmania,
    Victoria,
    WesternAustralia
)


class RegistryOceania(TestCase):
    def test_oceania(self):
        classes = set(registry.region_registry.values())
        self.assertIn(Australia, classes)
        self.assertIn(MarshallIslands, classes)
        self.assertIn(NewZealand, classes)
        for klass in AUSTRALIAN_TERRITORIES:
            self.assertIn(klass, classes)

    def test_australia_territories(self):
        # Get all the subregions
        classes = set(registry.get_subregions('AU').values())
        for klass in AUSTRALIAN_TERRITORIES:
            self.assertIn(klass, classes)