tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

count_unittests.py (855B)


      1 #!/usr/bin/env vpython3
      2 
      3 # Copyright 2024 The Chromium Authors
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 """File for testing count.py."""
      7 
      8 import unittest
      9 from count import Count
     10 
     11 
     12 class CountTest(unittest.TestCase):
     13  """Test count.py."""
     14 
     15  def test_no_record(self) -> None:
     16    count = Count("a")
     17    self.assertEqual(count.dump().name, "a")
     18    self.assertEqual(count.dump().value, 0)
     19 
     20  def test_one_record(self) -> None:
     21    count = Count("b")
     22    count.record()
     23    self.assertEqual(count.dump().name, "b")
     24    self.assertEqual(count.dump().value, 1)
     25 
     26  def test_more_records(self) -> None:
     27    count = Count("c")
     28    count.record()
     29    count.record()
     30    self.assertEqual(count.dump().name, "c")
     31    self.assertEqual(count.dump().value, 2)
     32 
     33 
     34 if __name__ == '__main__':
     35  unittest.main()