Example #1
0
 def test_no_match_quasispace(self):
     """
     Test not matching a quasispace portal
     """
     q = Quasispace(5000, 5000, 5000, 5000, 'C')
     ndf = NameDispFilter('Quasispace Exit F', False)
     self.assertEqual(ndf.approve(q), False)
Example #2
0
 def test_no_match_quasispace_extra(self):
     """
     Test not matching a quasispace portal, when the filter is allowed
     to search for extra text
     """
     q = Quasispace(5000, 5000, 5000, 5000, 'C')
     ndf = NameDispFilter('Quasispace Exit F', True)
     self.assertEqual(ndf.approve(q), False)
Example #3
0
class QuasispaceTests(unittest.TestCase):
    """
    Tests for our `Quasispace` class.  This essentially just pretends to be
    a System for the purposes of filtering, but is really just holding a couple
    of extra quasispace coordinates.  Doesn't have any mineral data or anything
    like that.
    """

    def setUp(self):
        """
        Some vars we might need on (nearly) every test
        """
        self.q = Quasispace(5000, 5000, 4000, 4000, 'Q')

    def test_init(self):
        """
        Tests our basic initialization routine
        """
        self.assertEqual(self.q.fullname, 'Quasispace Exit Q')
        self.assertEqual(self.q.label, 'Q')
        self.assertEqual(self.q.x, 5000)
        self.assertEqual(self.q.y, 5000)
        self.assertEqual(self.q.qs_x, 4000)
        self.assertEqual(self.q.qs_y, 4000)
        self.assertEqual(self.q.is_quasispace, True)

    def test_distance_to_self(self):
        """
        Tests computing the distance to ourself
        """
        self.assertAlmostEqual(self.q.distance_to(self.q), 0)

    def test_distance_close(self):
        """
        Tests computing the distance to another system close by
        """
        s2 = System(2, 'System', 'Beta', 5500, 5000, 'blue dwarf', '')
        self.assertAlmostEqual(self.q.distance_to(s2), 50)

    def test_distance_diagonal(self):
        """
        Tests computing the distance to another system at a diagonal
        """
        s2 = System(2, 'System', 'Beta', 3000, 7000, 'blue dwarf', '')
        self.assertAlmostEqual(self.q.distance_to(s2), 282.84, 2)
Example #4
0
 def setUp(self):
     """
     Some objects which we're likely to want in various tests
     """
     self.system_center = System(1, 'Center', 'Alpha', 5000, 5000,
                                 'white dwarf', '')
     self.pdf = ProxDispFilter(self.system_center, 100)
     self.quasi_center = Quasispace(5000, 5000, 5000, 5000, 'X')
     self.qpdf = ProxDispFilter(self.quasi_center, 100)
Example #5
0
 def test_quasi_match_quasispace(self):
     """
     Test matching a quasispace system, with quasispace origin
     """
     quasi_close = Quasispace(4900, 4900, 3000, 3000, 'C')
     self.assertEqual(self.qpdf.approve(quasi_close), True)
Example #6
0
 def test_not_match_quasispace(self):
     """
     Test not matching a far quasispace
     """
     quasi_far = Quasispace(1000, 1000, 4000, 4000, 'F')
     self.assertEqual(self.pdf.approve(quasi_far), False)
Example #7
0
 def setUp(self):
     """
     Some vars we might need on (nearly) every test
     """
     self.q = Quasispace(5000, 5000, 4000, 4000, 'Q')